File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,10 @@ import { OBJECT, isUndefined } from './shared'
66// complexity is almost O(1).
77const table = new WeakMap < object , number | string > ( )
88
9- const isObjectType = ( value : any , type : string ) =>
10- OBJECT . prototype . toString . call ( value ) === `[object ${ type } ]`
9+ const getTypeName = ( value : any ) => OBJECT . prototype . toString . call ( value )
10+
11+ const isObjectTypeName = ( typeName : string , type : string ) =>
12+ typeName === `[object ${ type } ]`
1113
1214// counter of the key
1315let counter = 0
@@ -22,9 +24,10 @@ let counter = 0
2224// parsable.
2325export const stableHash = ( arg : any ) : string => {
2426 const type = typeof arg
25- const isDate = isObjectType ( arg , 'Date' )
26- const isRegex = isObjectType ( arg , 'RegExp' )
27- const isPlainObject = isObjectType ( arg , 'Object' )
27+ const typeName = getTypeName ( arg )
28+ const isDate = isObjectTypeName ( typeName , 'Date' )
29+ const isRegex = isObjectTypeName ( typeName , 'RegExp' )
30+ const isPlainObject = isObjectTypeName ( typeName , 'Object' )
2831 let result : any
2932 let index : any
3033
You can’t perform that action at this time.
0 commit comments