Add is.numericString()
This commit is contained in:
parent
c983ffa4cd
commit
b407e383f8
2 changed files with 12 additions and 1 deletions
|
|
@ -135,10 +135,13 @@ namespace is { // tslint:disable-line:no-namespace
|
|||
export const symbol = isOfType<Symbol>('symbol');
|
||||
// tslint:enable:variable-name
|
||||
|
||||
export const nullOrUndefined = (value: any): value is null | undefined => null_(value) || undefined(value);
|
||||
export const numericString = (value: any): value is String =>
|
||||
!Number.isNaN(Number(value)) && !nullOrUndefined(value);
|
||||
|
||||
export const array = Array.isArray;
|
||||
export const buffer = isBuffer;
|
||||
|
||||
export const nullOrUndefined = (value: any): value is null | undefined => null_(value) || undefined(value);
|
||||
export const object = (value: any): value is object => !nullOrUndefined(value) && (function_(value) || isObject(value));
|
||||
export const iterable = (value: any): value is IterableIterator<any> => !nullOrUndefined(value) && function_(value[Symbol.iterator]);
|
||||
export const asyncIterable = (value: any): value is AsyncIterableIterator<any> => !nullOrUndefined(value) && function_(value[Symbol.asyncIterator]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue