Skip to content

Commit 276b11a

Browse files
committed
Added nonEmpty-String and -Json checks
1 parent d4d28b8 commit 276b11a

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
@@ -85,13 +85,27 @@ SnowPlow.isJson = function (property) {
8585
return (SnowPlow.isDefined(property) && SnowPlow.isNotNull(property) && property.constructor === {}.constructor);
8686
}
8787

88+
/*
89+
* Is property a non-empty JSON?
90+
*/
91+
SnowPlow.isNonEmptyJson = function (property) {
92+
return SnowPlow.isJson(property) && property !== {};
93+
}
94+
8895
/*
8996
* Is property a string?
9097
*/
9198
SnowPlow.isString = function (property) {
9299
return typeof property === 'string' || property instanceof String;
93100
}
94101

102+
/*
103+
* Is property a non-empty string?
104+
*/
105+
SnowPlow.isNonEmptyString = function (property) {
106+
return SnowPlow.isString(property) && property !== '';
107+
}
108+
95109
/*
96110
* Is property a date?
97111
*/

0 commit comments

Comments
 (0)