File tree 3 files changed +18
-0
lines changed
3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -50,11 +50,15 @@ if (isArray(value)) {
50
50
- ` isFunction() `
51
51
- ` isGuid() `
52
52
- ` isInfinity() `
53
+ - ` isNegativeNumber() `
53
54
- ` isNull() `
54
55
- ` isNil() `
56
+ - ` isNonEmptyString() `
57
+ - ` isNonZeroNumber() `
55
58
- ` isNumber() `
56
59
- ` isObject() `
57
60
- ` isPlainObject() `
61
+ - ` isPositiveNumber() `
58
62
- ` isRegExp() `
59
63
- ` isString() `
60
64
- ` isSymbol() `
Original file line number Diff line number Diff line change @@ -91,6 +91,11 @@ describe('ts-util-is methods', () => {
91
91
expect ( util . isString ( '' ) ) . toEqual ( true ) ;
92
92
} ) ;
93
93
94
+ it ( 'ensure value is a non empty string' , ( ) => {
95
+ expect ( util . isNonEmptyString ( '' ) ) . toBe ( false ) ;
96
+ expect ( util . isNonEmptyString ( 'something' ) ) . toBe ( true ) ;
97
+ } ) ;
98
+
94
99
it ( 'ensure value is a symbol' , ( ) => {
95
100
expect ( util . isSymbol ( Symbol ( ) ) ) . toEqual ( true ) ;
96
101
} ) ;
Original file line number Diff line number Diff line change @@ -184,6 +184,15 @@ export function isString(value: any): value is string {
184
184
return typeof value === 'string' ;
185
185
}
186
186
187
+ /**
188
+ * Determines if a reference is a `String` and not the empty string.
189
+ *
190
+ * @param value Reference to check
191
+ */
192
+ export function isNonEmptyString ( value : unknown ) : value is string {
193
+ return isString ( value ) && ! ! value ;
194
+ }
195
+
187
196
/**
188
197
* Determines if a reference is a `Symbol`.
189
198
*
You can’t perform that action at this time.
0 commit comments