Skip to content

Commit 40adcc8

Browse files
committed
3 new helpers for 'hasOwnProperty' checks
1 parent 0a07ea9 commit 40adcc8

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

v3/src/utils/object/HasAll.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
var HasAll = function (source, keys)
2+
{
3+
for (var i = 0; i < keys.length; i++)
4+
{
5+
if (!source.hasOwnProperty(keys[i]))
6+
{
7+
return false;
8+
}
9+
}
10+
11+
return true;
12+
};
13+
14+
module.exports = HasAll;

v3/src/utils/object/HasAny.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
var HasAny = function (source, keys)
2+
{
3+
for (var i = 0; i < keys.length; i++)
4+
{
5+
if (source.hasOwnProperty(keys[i]))
6+
{
7+
return true;
8+
}
9+
}
10+
11+
return false;
12+
};
13+
14+
module.exports = HasAny;

v3/src/utils/object/HasValue.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
var HasValue = function (source, key)
2+
{
3+
return (source.hasOwnProperty(key));
4+
};
5+
6+
module.exports = HasValue;

0 commit comments

Comments
 (0)