type FnType = ( val : unknown ) => boolean ; export const IsObj = { defined ( val , ... args ) { return val !== void 0 ; } , undefined ( val , ... args ) { return val === void 0 ; } , null ( val , ... args ) { return val === null ; } , exist ( val ? , ... args ) { return val != null ; } , function ( val , ... args ) { return typeof val === 'function' ; } , true ( val , ... args ) { return val === true ; } , false ( val , ... args ) { return val === false ; } , } ; const Derivatives = { not ( fn ) { return function ( ) { return fn . apply ( null , [ ... arguments ] as any ) ; } ; } , all ( fn ) { return function ( ) { if ( Array . isArray ( arguments [ 0 ] ) ) { return arguments [ 0 ] . every ( fn ) ; } return [ ... arguments ] . every ( fn ) ; } ; } , any ( fn ) { return function ( ) { if ( Array . isArray ( arguments [ 0 ] ) ) { return arguments [ 0 ] . some ( fn ) ; } return [ ... arguments ] . some ( fn ) ; } ; } , } ; const NotObj = { defined ( val , ... args ) { return val === void 0 ; } , undefined ( val , ... args ) { return val !== void 0 ; } , null ( val , ... args ) { return val !== null ; } , exist ( val ? , ... args ) { return val == null ; } , function ( val , ... args ) { return typeof val !== 'function' ; } , true ( val , ... args ) { return val !== true ; } , false ( val , ... args ) { return val !== false ; } , } ; type IsImplType = typeof IsObj ; interface IsType extends IsImplType { not : typeof NotObj ; all : typeof IsObj ; any : typeof IsObj ; } for ( const subFn in Derivatives ) { if ( Object . prototype . hasOwnProperty . call ( Derivatives , subFn ) ) { ( IsObj as any ) [ subFn ] = { } as typeof IsObj ; for ( const fn in IsObj ) { if ( Object . prototype . hasOwnProperty . call ( IsObj , fn ) ) { if ( subFn === 'not' ) { ( IsObj as any ) [ subFn ] [ fn ] = ( Derivatives as any ) [ subFn ] ( ( NotObj as never ) [ fn ] ) ; } else { ( IsObj as any ) [ subFn ] [ fn ] = ( Derivatives as any ) [ subFn ] ( ( IsObj as never ) [ fn ] ) ; } } } } } export const Is = IsObj as IsType ;