import { objKeys } from './obj.util' ; export const isUndefined = ( val ) : boolean => typeof val === 'undefined' ; export const isNull = ( val ) : boolean => val === null ; export const isNil = ( val ) : boolean => isUndefined ( val ) || isNull ( val ) ; export const isString = ( val ) : boolean => typeof val === 'string' ; export const hasLength = ( val ) : boolean => val . length > 0 ; export const isStringFull = ( val ) : boolean => isString ( val ) && hasLength ( val ) ; export const isArrayFull = ( val ) : boolean => Array . isArray ( val ) && hasLength ( val ) ; export const isArrayStrings = ( val ) : boolean => isArrayFull ( val ) && ( val as string [ ] ) . every ( ( v ) => isStringFull ( v ) ) ; export const isObject = ( val ) : boolean => typeof val === 'object' && ! isNull ( val ) ; export const isObjectFull = ( val ) => isObject ( val ) && hasLength ( objKeys ( val ) ) ; export const isNumber = ( val ) : boolean => typeof val === 'number' && ! Number . isNaN ( val ) && Number . isFinite ( val ) ; export const isEqual = ( val , eq ) : boolean => val === eq ; export const isFalse = ( val ) : boolean => val === false ; export const isTrue = ( val ) : boolean => val === true ; export const isIn = ( val , arr = [ ] ) : boolean => arr . some ( ( o ) => isEqual ( val , o ) ) ; export const isBoolean = ( val ) : boolean => typeof val === 'boolean' ; export const isNumeric = ( val ) : boolean => /^[+-]?([0-9]*[.])?[0-9]+$/ . test ( val ) ; export const isDateString = ( val ) : boolean => isStringFull ( val ) && /^\d{4}-[01]\d-[0-3]\d(?:T[0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[-+][0-2]\d(?::?[0-5]\d)?)?)?$/g . test ( val ) ; export const isDate = ( val ) : val is Date => val instanceof Date ; export const isValue = ( val ) : boolean => isStringFull ( val ) || isNumber ( val ) || isBoolean ( val ) || isDate ( val ) ; export const hasValue = ( val ) : boolean => isArrayFull ( val ) ? ( val as any [ ] ) . every ( ( o ) => isValue ( o ) ) : isValue ( val ) ; export const isFunction = ( val ) : boolean => typeof val === 'function' ;