diff options
Diffstat (limited to 'packages/webapi/src/lib/Object.ts')
-rw-r--r-- | packages/webapi/src/lib/Object.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/webapi/src/lib/Object.ts b/packages/webapi/src/lib/Object.ts new file mode 100644 index 000000000..5ad5b1388 --- /dev/null +++ b/packages/webapi/src/lib/Object.ts @@ -0,0 +1,20 @@ +import * as _ from './utils' + +export const hasOwn = { + hasOwn(instance: object, property: any) { + return _.__object_hasOwnProperty(instance, property) + } +}.hasOwn + +export const initObject = (target: any, exclude: Set<string>) => { + if (exclude.has('Object') || exclude.has('object') || exclude.has('hasOwn')) return + + const Class = target.Object || globalThis.Object + + Object.defineProperty(Class, 'hasOwn', { + value: hasOwn, + writable: true, + enumerable: false, + configurable: true + }) +} |