adtec-core-package 3.0.7 → 3.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type ObjectWithHasOwn = typeof Object & {
|
|
2
|
+
hasOwn?: (object: object, property: PropertyKey) => boolean
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
/** 旧浏览器 / 部分 WebView 无 Object.hasOwn,需在业务 bundle 之前注入 */
|
|
6
|
+
export function applyObjectHasOwnPolyfill(target: typeof globalThis = globalThis) {
|
|
7
|
+
const objectCtor = target.Object as ObjectWithHasOwn
|
|
8
|
+
if (typeof objectCtor.hasOwn === 'function') {
|
|
9
|
+
return
|
|
10
|
+
}
|
|
11
|
+
objectCtor.hasOwn = function (object, property) {
|
|
12
|
+
return objectCtor.prototype.hasOwnProperty.call(object, property)
|
|
13
|
+
}
|
|
14
|
+
}
|