Skip to content

Commit d01bedb

Browse files
committed
Added isNotNull and isJson checks
1 parent 6828a7a commit d01bedb

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/js/helpers.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ SnowPlow.isDefined = function (property) {
3939
return typeof property !== 'undefined';
4040
}
4141

42+
/**
43+
* Is property null?
44+
*/
45+
SnowPlow.isNotNull = function (property) {
46+
return property !== null;
47+
}
48+
4249
/*
4350
* Is property a function?
4451
*/
@@ -71,6 +78,13 @@ SnowPlow.isObject = function (property) {
7178
return typeof property === 'object';
7279
}
7380

81+
/*
82+
* Is property a JSON?
83+
*/
84+
SnowPlow.isJson = function (property) {
85+
return (SnowPlow.isDefined(property) && SnowPlow.isNotNull(property) && property.constructor === {}.constructor);
86+
}
87+
7488
/*
7589
* Is property a string?
7690
*/

0 commit comments

Comments
 (0)