module author Surmon <https://github.com/surmon-china>
  import { useReducer } from 'react' ; export type ArgumentTypes < F extends Function > = F extends ( ... args : infer A ) => any ? A : never ; export const increment = ( s ) => s + 1 ; export const useForceUpdate = ( ) => useReducer ( increment , 0 ) [ 1 ] ; export const hasChanged = ( value , oldValue ) : boolean => { return value !== oldValue && ( value === value || oldValue === oldValue ) ; } ; export const isArray = Array . isArray ; export const objectToString = Object . prototype . toString ; export const toTypeString = ( value ) : string => { return objectToString . call ( value ) ; } ; export const isMap = ( value ) : value is Map < any , any > => { return toTypeString ( value ) === '[object Map]' ; } ; export const isSet = ( value ) : value is Set < any > => { return toTypeString ( value ) === '[object Set]' ; } ; export const isDate = ( value ) : value is Date => { return value instanceof Date ; } ; export const isFunction = ( value ) : value is Function => { return typeof value === 'function' ; } ; export const isString = ( value ) : value is string => { return typeof value === 'string' ; } ; export const isSymbol = ( value ) : value is symbol => { return typeof value === 'symbol' ; } ; export const isObject = ( value ) : value is Record < any , any > => { return value !== null && typeof value === 'object' ; } ; export const isPlainObject = ( value ) : value is object => { return toTypeString ( value ) === '[object Object]' ; } ; export const isPromise = < T = any > ( value ) : value is Promise < T > => { return isObject ( value ) && isFunction ( value . then ) && isFunction ( value . catch ) ; } ;