@alwatr/polyfill-has-own
Version:
A polyfill for `Object.hasOwn`.
8 lines (7 loc) • 667 B
Source Map (JSON)
{
"version": 3,
"sources": ["../src/main.ts"],
"sourcesContent": ["/* eslint-disable no-prototype-builtins */\n\n/**\n * A polyfill for Object.hasOwn\n *\n * @example\n * ```typescript\n * import '@alwatr/polyfill-has-own';\n *\n * const obj = { foo: 'bar' };\n * Object.hasOwn(obj, 'foo'); // true\n * ```\n */\nif (Object.prototype.hasOwnProperty.call(Object, 'hasOwn') === false) {\n // @ts-expect-error - TS doesn't know about this polyfill\n Object.hasOwn = Object.call.bind(Object.prototype.hasOwnProperty);\n}\n"],
"mappings": ";;aAaA,GAAI,OAAO,UAAU,eAAe,KAAK,OAAQ,QAAQ,IAAM,MAAO,CAEpE,OAAO,OAAS,OAAO,KAAK,KAAK,OAAO,UAAU,cAAc,CAClE",
"names": []
}