refactor: extract hasOwn helper
This commit is contained in:
@@ -15,6 +15,12 @@ export const extend = <T extends object, U extends object>(
|
||||
return a as any
|
||||
}
|
||||
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty
|
||||
export const hasOwn = (
|
||||
val: object,
|
||||
key: string | symbol
|
||||
): key is keyof typeof val => hasOwnProperty.call(val, key)
|
||||
|
||||
export const isArray = Array.isArray
|
||||
export const isFunction = (val: any): val is Function =>
|
||||
typeof val === 'function'
|
||||
|
||||
Reference in New Issue
Block a user