forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHasAny.js
More file actions
31 lines (28 loc) · 793 Bytes
/
Copy pathHasAny.js
File metadata and controls
31 lines (28 loc) · 793 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2020 Photon Storm Ltd.
* @license {@link https://opensource.org/licenses/MIT|MIT License}
*/
/**
* Verifies that an object contains at least one of the requested keys
*
* @function Phaser.Utils.Objects.HasAny
* @since 3.0.0
*
* @param {object} source - an object on which to check for key existence
* @param {string[]} keys - an array of keys to search the object for
*
* @return {boolean} true if the source object contains at least one of the keys, false otherwise
*/
var HasAny = function (source, keys)
{
for (var i = 0; i < keys.length; i++)
{
if (source.hasOwnProperty(keys[i]))
{
return true;
}
}
return false;
};
module.exports = HasAny;