function parsePrototype ( data ) { const typeStr = Object . prototype . toString . call ( data ) || '' ; const result = typeStr . replace ( /(\[object|\])/ig , '' ) . trim ( ) ; return result ; } const istype = { type ( data , lowerCase ? ) { const result = parsePrototype ( data ) ; return lowerCase === true ? result . toLocaleLowerCase ( ) : result ; } , array ( data ) { return parsePrototype ( data ) === 'Array' ; } , json ( data ) { return parsePrototype ( data ) === 'Object' ; } , function ( data ) { return parsePrototype ( data ) === 'Function' ; } , asyncFunction ( data ) { return parsePrototype ( data ) === 'AsyncFunction' ; } , string ( data ) { return parsePrototype ( data ) === 'String' ; } , number ( data ) { return parsePrototype ( data ) === 'Number' ; } , undefined ( data ) { return parsePrototype ( data ) === 'Undefined' ; } , null ( data ) { return parsePrototype ( data ) === 'Null' ; } , promise ( data ) { return parsePrototype ( data ) === 'Promise' ; } , } ; export default istype ;