diff --git a/README.md b/README.md index ec60e853b35d..7061adc5c64f 100644 --- a/README.md +++ b/README.md @@ -186,8 +186,6 @@ structuredClone(new Set([1, 2, 3])); // => new Set([1, 2, 3]) - [Stage 0 proposals](#stage-0-proposals) - [`Function.prototype.demethodize`](#functionprototypedemethodize) - [`Function.{ isCallable, isConstructor }`](#function-iscallable-isconstructor-) - - [Pre-stage 0 proposals](#pre-stage-0-proposals) - - [`Reflect` metadata](#reflect-metadata) - [Web standards](#web-standards) - [`self`](#self) - [`structuredClone`](#structuredclone) @@ -3055,48 +3053,6 @@ Function.isConstructor(() => {}); // => false Function.isConstructor(class {}); // => true ``` -#### Pre-stage 0 proposals[⬆](#index) -[*CommonJS entry points:*](#commonjs-api) -```js -core-js(-pure)/stage/pre -``` -##### [`Reflect` metadata](https://github.com/rbuckton/reflect-metadata)[⬆](#index) -Modules [`esnext.reflect.define-metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.define-metadata.js), [`esnext.reflect.delete-metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.delete-metadata.js), [`esnext.reflect.get-metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.get-metadata.js), [`esnext.reflect.get-metadata-keys`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.get-metadata-keys.js), [`esnext.reflect.get-own-metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.get-own-metadata.js), [`esnext.reflect.get-own-metadata-keys`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.get-own-metadata-keys.js), [`esnext.reflect.has-metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.has-metadata.js), [`esnext.reflect.has-own-metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.has-own-metadata.js) and [`esnext.reflect.metadata`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/esnext.reflect.metadata.js). -```js -namespace Reflect { - defineMetadata(metadataKey: any, metadataValue: any, target: Object, propertyKey?: PropertyKey): void; - getMetadata(metadataKey: any, target: Object, propertyKey?: PropertyKey): any; - getOwnMetadata(metadataKey: any, target: Object, propertyKey?: PropertyKey): any; - hasMetadata(metadataKey: any, target: Object, propertyKey?: PropertyKey): boolean; - hasOwnMetadata(metadataKey: any, target: Object, propertyKey?: PropertyKey): boolean; - deleteMetadata(metadataKey: any, target: Object, propertyKey?: PropertyKey): boolean; - getMetadataKeys(target: Object, propertyKey?: PropertyKey): Array; - getOwnMetadataKeys(target: Object, propertyKey?: PropertyKey): Array; - metadata(metadataKey: any, metadataValue: any): decorator(target: Object, targetKey?: PropertyKey) => void; -} -``` -[*CommonJS entry points:*](#commonjs-api) -```js -core-js/proposals/reflect-metadata -core-js(-pure)/full/reflect/define-metadata -core-js(-pure)/full/reflect/delete-metadata -core-js(-pure)/full/reflect/get-metadata -core-js(-pure)/full/reflect/get-metadata-keys -core-js(-pure)/full/reflect/get-own-metadata -core-js(-pure)/full/reflect/get-own-metadata-keys -core-js(-pure)/full/reflect/has-metadata -core-js(-pure)/full/reflect/has-own-metadata -core-js(-pure)/full/reflect/metadata -``` -[*Examples*](https://goo.gl/KCo3PS): -```js -let object = {}; -Reflect.defineMetadata('foo', 'bar', object); -Reflect.ownKeys(object); // => [] -Reflect.getOwnMetadataKeys(object); // => ['foo'] -Reflect.getOwnMetadata('foo', object); // => 'bar' -``` - ### Web standards[⬆](#index) #### `self`[⬆](#index) [Spec](https://html.spec.whatwg.org/multipage/window-object.html#dom-self), module [`web.self`](https://github.com/zloirock/core-js/blob/master/packages/core-js/modules/web.self.js) diff --git a/packages/core-js-compat/src/data.mjs b/packages/core-js-compat/src/data.mjs index ad0cd37b2bff..a8066953f902 100644 --- a/packages/core-js-compat/src/data.mjs +++ b/packages/core-js-compat/src/data.mjs @@ -1975,33 +1975,6 @@ export const data = { bun: '0.7.1', chrome: '119', }, - // TODO: Remove from `core-js@4` - 'esnext.reflect.define-metadata': { - }, - // TODO: Remove from `core-js@4` - 'esnext.reflect.delete-metadata': { - }, - // TODO: Remove from `core-js@4` - 'esnext.reflect.get-metadata': { - }, - // TODO: Remove from `core-js@4` - 'esnext.reflect.get-metadata-keys': { - }, - // TODO: Remove from `core-js@4` - 'esnext.reflect.get-own-metadata': { - }, - // TODO: Remove from `core-js@4` - 'esnext.reflect.get-own-metadata-keys': { - }, - // TODO: Remove from `core-js@4` - 'esnext.reflect.has-metadata': { - }, - // TODO: Remove from `core-js@4` - 'esnext.reflect.has-own-metadata': { - }, - // TODO: Remove from `core-js@4` - 'esnext.reflect.metadata': { - }, 'esnext.regexp.escape': { }, 'esnext.set.add-all': { diff --git a/packages/core-js/full/reflect/define-metadata.js b/packages/core-js/full/reflect/define-metadata.js deleted file mode 100644 index 76502dbab4de..000000000000 --- a/packages/core-js/full/reflect/define-metadata.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; -require('../../modules/es.map.constructor'); -require('../../modules/es.weak-map.constructor'); -require('../../modules/esnext.reflect.define-metadata'); -var path = require('../../internals/path'); - -module.exports = path.Reflect.defineMetadata; diff --git a/packages/core-js/full/reflect/delete-metadata.js b/packages/core-js/full/reflect/delete-metadata.js deleted file mode 100644 index ba69b2b2b6d5..000000000000 --- a/packages/core-js/full/reflect/delete-metadata.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; -require('../../modules/es.map.constructor'); -require('../../modules/es.weak-map.constructor'); -require('../../modules/esnext.reflect.delete-metadata'); -var path = require('../../internals/path'); - -module.exports = path.Reflect.deleteMetadata; diff --git a/packages/core-js/full/reflect/get-metadata-keys.js b/packages/core-js/full/reflect/get-metadata-keys.js deleted file mode 100644 index e38ccab37189..000000000000 --- a/packages/core-js/full/reflect/get-metadata-keys.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; -require('../../modules/es.map.constructor'); -require('../../modules/es.weak-map.constructor'); -require('../../modules/esnext.reflect.get-metadata-keys'); -var path = require('../../internals/path'); - -module.exports = path.Reflect.getMetadataKeys; diff --git a/packages/core-js/full/reflect/get-metadata.js b/packages/core-js/full/reflect/get-metadata.js deleted file mode 100644 index b0c667e22217..000000000000 --- a/packages/core-js/full/reflect/get-metadata.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; -require('../../modules/es.map.constructor'); -require('../../modules/es.weak-map.constructor'); -require('../../modules/esnext.reflect.get-metadata'); -var path = require('../../internals/path'); - -module.exports = path.Reflect.getMetadata; diff --git a/packages/core-js/full/reflect/get-own-metadata-keys.js b/packages/core-js/full/reflect/get-own-metadata-keys.js deleted file mode 100644 index 2829498997f2..000000000000 --- a/packages/core-js/full/reflect/get-own-metadata-keys.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; -require('../../modules/es.map.constructor'); -require('../../modules/es.weak-map.constructor'); -require('../../modules/esnext.reflect.get-own-metadata-keys'); -var path = require('../../internals/path'); - -module.exports = path.Reflect.getOwnMetadataKeys; diff --git a/packages/core-js/full/reflect/get-own-metadata.js b/packages/core-js/full/reflect/get-own-metadata.js deleted file mode 100644 index 117bb9e61b63..000000000000 --- a/packages/core-js/full/reflect/get-own-metadata.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; -require('../../modules/es.map.constructor'); -require('../../modules/es.weak-map.constructor'); -require('../../modules/esnext.reflect.get-own-metadata'); -var path = require('../../internals/path'); - -module.exports = path.Reflect.getOwnMetadata; diff --git a/packages/core-js/full/reflect/has-metadata.js b/packages/core-js/full/reflect/has-metadata.js deleted file mode 100644 index 4334f5b4a8cb..000000000000 --- a/packages/core-js/full/reflect/has-metadata.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; -require('../../modules/es.map.constructor'); -require('../../modules/es.weak-map.constructor'); -require('../../modules/esnext.reflect.has-metadata'); -var path = require('../../internals/path'); - -module.exports = path.Reflect.hasMetadata; diff --git a/packages/core-js/full/reflect/has-own-metadata.js b/packages/core-js/full/reflect/has-own-metadata.js deleted file mode 100644 index dc02d98a7950..000000000000 --- a/packages/core-js/full/reflect/has-own-metadata.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; -require('../../modules/es.map.constructor'); -require('../../modules/es.weak-map.constructor'); -require('../../modules/esnext.reflect.has-own-metadata'); -var path = require('../../internals/path'); - -module.exports = path.Reflect.hasOwnMetadata; diff --git a/packages/core-js/full/reflect/index.js b/packages/core-js/full/reflect/index.js index 55c7ff58eb3b..4be97b4269c0 100644 --- a/packages/core-js/full/reflect/index.js +++ b/packages/core-js/full/reflect/index.js @@ -1,15 +1,4 @@ 'use strict'; var parent = require('../../actual/reflect'); -require('../../modules/es.map.constructor'); -require('../../modules/es.weak-map.constructor'); -require('../../modules/esnext.reflect.define-metadata'); -require('../../modules/esnext.reflect.delete-metadata'); -require('../../modules/esnext.reflect.get-metadata'); -require('../../modules/esnext.reflect.get-metadata-keys'); -require('../../modules/esnext.reflect.get-own-metadata'); -require('../../modules/esnext.reflect.get-own-metadata-keys'); -require('../../modules/esnext.reflect.has-metadata'); -require('../../modules/esnext.reflect.has-own-metadata'); -require('../../modules/esnext.reflect.metadata'); module.exports = parent; diff --git a/packages/core-js/full/reflect/metadata.js b/packages/core-js/full/reflect/metadata.js deleted file mode 100644 index a509022cb177..000000000000 --- a/packages/core-js/full/reflect/metadata.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; -require('../../modules/es.map.constructor'); -require('../../modules/es.weak-map.constructor'); -require('../../modules/esnext.reflect.metadata'); -var path = require('../../internals/path'); - -module.exports = path.Reflect.metadata; diff --git a/packages/core-js/internals/reflect-metadata.js b/packages/core-js/internals/reflect-metadata.js deleted file mode 100644 index c9cfe06b5003..000000000000 --- a/packages/core-js/internals/reflect-metadata.js +++ /dev/null @@ -1,59 +0,0 @@ -'use strict'; -var getBuiltIn = require('../internals/get-built-in'); -var uncurryThis = require('../internals/function-uncurry-this'); -var shared = require('../internals/shared'); - -var Map = getBuiltIn('Map'); -var WeakMap = getBuiltIn('WeakMap'); -var push = uncurryThis([].push); - -var metadata = shared('metadata'); -var store = metadata.store || (metadata.store = new WeakMap()); - -var getOrCreateMetadataMap = function (target, targetKey, create) { - var targetMetadata = store.get(target); - if (!targetMetadata) { - if (!create) return; - store.set(target, targetMetadata = new Map()); - } - var keyMetadata = targetMetadata.get(targetKey); - if (!keyMetadata) { - if (!create) return; - targetMetadata.set(targetKey, keyMetadata = new Map()); - } return keyMetadata; -}; - -var ordinaryHasOwnMetadata = function (MetadataKey, O, P) { - var metadataMap = getOrCreateMetadataMap(O, P, false); - return metadataMap === undefined ? false : metadataMap.has(MetadataKey); -}; - -var ordinaryGetOwnMetadata = function (MetadataKey, O, P) { - var metadataMap = getOrCreateMetadataMap(O, P, false); - return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey); -}; - -var ordinaryDefineOwnMetadata = function (MetadataKey, MetadataValue, O, P) { - getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue); -}; - -var ordinaryOwnMetadataKeys = function (target, targetKey) { - var metadataMap = getOrCreateMetadataMap(target, targetKey, false); - var keys = []; - if (metadataMap) metadataMap.forEach(function (_, key) { push(keys, key); }); - return keys; -}; - -var toMetadataKey = function (it) { - return it === undefined || typeof it == 'symbol' ? it : String(it); -}; - -module.exports = { - store: store, - getMap: getOrCreateMetadataMap, - has: ordinaryHasOwnMetadata, - get: ordinaryGetOwnMetadata, - set: ordinaryDefineOwnMetadata, - keys: ordinaryOwnMetadataKeys, - toKey: toMetadataKey, -}; diff --git a/packages/core-js/modules/esnext.reflect.define-metadata.js b/packages/core-js/modules/esnext.reflect.define-metadata.js deleted file mode 100644 index 807b90b3c2cf..000000000000 --- a/packages/core-js/modules/esnext.reflect.define-metadata.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; -// TODO: Remove from `core-js@4` -var $ = require('../internals/export'); -var ReflectMetadataModule = require('../internals/reflect-metadata'); -var anObject = require('../internals/an-object'); - -var toMetadataKey = ReflectMetadataModule.toKey; -var ordinaryDefineOwnMetadata = ReflectMetadataModule.set; - -// `Reflect.defineMetadata` method -// https://github.com/rbuckton/reflect-metadata -$({ target: 'Reflect', stat: true }, { - defineMetadata: function defineMetadata(metadataKey, metadataValue, target /* , targetKey */) { - var targetKey = arguments.length < 4 ? undefined : toMetadataKey(arguments[3]); - ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), targetKey); - }, -}); diff --git a/packages/core-js/modules/esnext.reflect.delete-metadata.js b/packages/core-js/modules/esnext.reflect.delete-metadata.js deleted file mode 100644 index 8ba7f837f5fa..000000000000 --- a/packages/core-js/modules/esnext.reflect.delete-metadata.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; -var $ = require('../internals/export'); -var ReflectMetadataModule = require('../internals/reflect-metadata'); -var anObject = require('../internals/an-object'); - -var toMetadataKey = ReflectMetadataModule.toKey; -var getOrCreateMetadataMap = ReflectMetadataModule.getMap; -var store = ReflectMetadataModule.store; - -// `Reflect.deleteMetadata` method -// https://github.com/rbuckton/reflect-metadata -$({ target: 'Reflect', stat: true }, { - deleteMetadata: function deleteMetadata(metadataKey, target /* , targetKey */) { - var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]); - var metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false); - if (metadataMap === undefined || !metadataMap.delete(metadataKey)) return false; - if (metadataMap.size) return true; - var targetMetadata = store.get(target); - targetMetadata.delete(targetKey); - return !!targetMetadata.size || store.delete(target); - }, -}); diff --git a/packages/core-js/modules/esnext.reflect.get-metadata-keys.js b/packages/core-js/modules/esnext.reflect.get-metadata-keys.js deleted file mode 100644 index 2ea7c7e70a45..000000000000 --- a/packages/core-js/modules/esnext.reflect.get-metadata-keys.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; -// TODO: Remove from `core-js@4` -var $ = require('../internals/export'); -var uncurryThis = require('../internals/function-uncurry-this'); -var ReflectMetadataModule = require('../internals/reflect-metadata'); -var anObject = require('../internals/an-object'); -var $arrayUniqueBy = require('../internals/array-unique-by'); - -var getPrototypeOf = Object.getPrototypeOf; -var arrayUniqueBy = uncurryThis($arrayUniqueBy); -var concat = uncurryThis([].concat); -var ordinaryOwnMetadataKeys = ReflectMetadataModule.keys; -var toMetadataKey = ReflectMetadataModule.toKey; - -var ordinaryMetadataKeys = function (O, P) { - var oKeys = ordinaryOwnMetadataKeys(O, P); - var parent = getPrototypeOf(O); - if (parent === null) return oKeys; - var pKeys = ordinaryMetadataKeys(parent, P); - return pKeys.length ? oKeys.length ? arrayUniqueBy(concat(oKeys, pKeys)) : pKeys : oKeys; -}; - -// `Reflect.getMetadataKeys` method -// https://github.com/rbuckton/reflect-metadata -$({ target: 'Reflect', stat: true }, { - getMetadataKeys: function getMetadataKeys(target /* , targetKey */) { - var targetKey = arguments.length < 2 ? undefined : toMetadataKey(arguments[1]); - return ordinaryMetadataKeys(anObject(target), targetKey); - }, -}); diff --git a/packages/core-js/modules/esnext.reflect.get-metadata.js b/packages/core-js/modules/esnext.reflect.get-metadata.js deleted file mode 100644 index 414726740b12..000000000000 --- a/packages/core-js/modules/esnext.reflect.get-metadata.js +++ /dev/null @@ -1,26 +0,0 @@ -'use strict'; -// TODO: Remove from `core-js@4` -var $ = require('../internals/export'); -var ReflectMetadataModule = require('../internals/reflect-metadata'); -var anObject = require('../internals/an-object'); - -var getPrototypeOf = Object.getPrototypeOf; -var ordinaryHasOwnMetadata = ReflectMetadataModule.has; -var ordinaryGetOwnMetadata = ReflectMetadataModule.get; -var toMetadataKey = ReflectMetadataModule.toKey; - -var ordinaryGetMetadata = function (MetadataKey, O, P) { - var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); - if (hasOwn) return ordinaryGetOwnMetadata(MetadataKey, O, P); - var parent = getPrototypeOf(O); - return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined; -}; - -// `Reflect.getMetadata` method -// https://github.com/rbuckton/reflect-metadata -$({ target: 'Reflect', stat: true }, { - getMetadata: function getMetadata(metadataKey, target /* , targetKey */) { - var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]); - return ordinaryGetMetadata(metadataKey, anObject(target), targetKey); - }, -}); diff --git a/packages/core-js/modules/esnext.reflect.get-own-metadata-keys.js b/packages/core-js/modules/esnext.reflect.get-own-metadata-keys.js deleted file mode 100644 index d7f409576176..000000000000 --- a/packages/core-js/modules/esnext.reflect.get-own-metadata-keys.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; -// TODO: Remove from `core-js@4` -var $ = require('../internals/export'); -var ReflectMetadataModule = require('../internals/reflect-metadata'); -var anObject = require('../internals/an-object'); - -var ordinaryOwnMetadataKeys = ReflectMetadataModule.keys; -var toMetadataKey = ReflectMetadataModule.toKey; - -// `Reflect.getOwnMetadataKeys` method -// https://github.com/rbuckton/reflect-metadata -$({ target: 'Reflect', stat: true }, { - getOwnMetadataKeys: function getOwnMetadataKeys(target /* , targetKey */) { - var targetKey = arguments.length < 2 ? undefined : toMetadataKey(arguments[1]); - return ordinaryOwnMetadataKeys(anObject(target), targetKey); - }, -}); diff --git a/packages/core-js/modules/esnext.reflect.get-own-metadata.js b/packages/core-js/modules/esnext.reflect.get-own-metadata.js deleted file mode 100644 index 15b8593f3aee..000000000000 --- a/packages/core-js/modules/esnext.reflect.get-own-metadata.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; -// TODO: Remove from `core-js@4` -var $ = require('../internals/export'); -var ReflectMetadataModule = require('../internals/reflect-metadata'); -var anObject = require('../internals/an-object'); - -var ordinaryGetOwnMetadata = ReflectMetadataModule.get; -var toMetadataKey = ReflectMetadataModule.toKey; - -// `Reflect.getOwnMetadata` method -// https://github.com/rbuckton/reflect-metadata -$({ target: 'Reflect', stat: true }, { - getOwnMetadata: function getOwnMetadata(metadataKey, target /* , targetKey */) { - var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]); - return ordinaryGetOwnMetadata(metadataKey, anObject(target), targetKey); - }, -}); diff --git a/packages/core-js/modules/esnext.reflect.has-metadata.js b/packages/core-js/modules/esnext.reflect.has-metadata.js deleted file mode 100644 index 9a3cee33e51d..000000000000 --- a/packages/core-js/modules/esnext.reflect.has-metadata.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict'; -// TODO: Remove from `core-js@4` -var $ = require('../internals/export'); -var ReflectMetadataModule = require('../internals/reflect-metadata'); -var anObject = require('../internals/an-object'); - -var getPrototypeOf = Object.getPrototypeOf; -var ordinaryHasOwnMetadata = ReflectMetadataModule.has; -var toMetadataKey = ReflectMetadataModule.toKey; - -var ordinaryHasMetadata = function (MetadataKey, O, P) { - var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); - if (hasOwn) return true; - var parent = getPrototypeOf(O); - return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false; -}; - -// `Reflect.hasMetadata` method -// https://github.com/rbuckton/reflect-metadata -$({ target: 'Reflect', stat: true }, { - hasMetadata: function hasMetadata(metadataKey, target /* , targetKey */) { - var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]); - return ordinaryHasMetadata(metadataKey, anObject(target), targetKey); - }, -}); diff --git a/packages/core-js/modules/esnext.reflect.has-own-metadata.js b/packages/core-js/modules/esnext.reflect.has-own-metadata.js deleted file mode 100644 index b3009283f08a..000000000000 --- a/packages/core-js/modules/esnext.reflect.has-own-metadata.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; -// TODO: Remove from `core-js@4` -var $ = require('../internals/export'); -var ReflectMetadataModule = require('../internals/reflect-metadata'); -var anObject = require('../internals/an-object'); - -var ordinaryHasOwnMetadata = ReflectMetadataModule.has; -var toMetadataKey = ReflectMetadataModule.toKey; - -// `Reflect.hasOwnMetadata` method -// https://github.com/rbuckton/reflect-metadata -$({ target: 'Reflect', stat: true }, { - hasOwnMetadata: function hasOwnMetadata(metadataKey, target /* , targetKey */) { - var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]); - return ordinaryHasOwnMetadata(metadataKey, anObject(target), targetKey); - }, -}); diff --git a/packages/core-js/modules/esnext.reflect.metadata.js b/packages/core-js/modules/esnext.reflect.metadata.js deleted file mode 100644 index 67c065091c28..000000000000 --- a/packages/core-js/modules/esnext.reflect.metadata.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; -var $ = require('../internals/export'); -var ReflectMetadataModule = require('../internals/reflect-metadata'); -var anObject = require('../internals/an-object'); - -var toMetadataKey = ReflectMetadataModule.toKey; -var ordinaryDefineOwnMetadata = ReflectMetadataModule.set; - -// `Reflect.metadata` method -// https://github.com/rbuckton/reflect-metadata -$({ target: 'Reflect', stat: true }, { - metadata: function metadata(metadataKey, metadataValue) { - return function decorator(target, key) { - ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetadataKey(key)); - }; - }, -}); diff --git a/packages/core-js/proposals/reflect-metadata.js b/packages/core-js/proposals/reflect-metadata.js deleted file mode 100644 index dfc75929f2b8..000000000000 --- a/packages/core-js/proposals/reflect-metadata.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; -// https://github.com/rbuckton/reflect-metadata -require('../modules/esnext.reflect.define-metadata'); -require('../modules/esnext.reflect.delete-metadata'); -require('../modules/esnext.reflect.get-metadata'); -require('../modules/esnext.reflect.get-metadata-keys'); -require('../modules/esnext.reflect.get-own-metadata'); -require('../modules/esnext.reflect.get-own-metadata-keys'); -require('../modules/esnext.reflect.has-metadata'); -require('../modules/esnext.reflect.has-own-metadata'); -require('../modules/esnext.reflect.metadata'); diff --git a/packages/core-js/stage/pre.js b/packages/core-js/stage/pre.js deleted file mode 100644 index e4a8ab1d9091..000000000000 --- a/packages/core-js/stage/pre.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict'; -require('./0'); - -require('../proposals/reflect-metadata'); diff --git a/tests/compat-data/tests-coverage.mjs b/tests/compat-data/tests-coverage.mjs index 420a705db6dc..28a332b2d608 100644 --- a/tests/compat-data/tests-coverage.mjs +++ b/tests/compat-data/tests-coverage.mjs @@ -9,15 +9,7 @@ const modulesSet = new Set([ const tested = new Set(Object.keys(globalThis.tests)); const ignore = new Set([ - 'esnext.reflect.define-metadata', - 'esnext.reflect.delete-metadata', - 'esnext.reflect.get-metadata', - 'esnext.reflect.get-metadata-keys', - 'esnext.reflect.get-own-metadata', - 'esnext.reflect.get-own-metadata-keys', - 'esnext.reflect.has-metadata', - 'esnext.reflect.has-own-metadata', - 'esnext.reflect.metadata', + // empty ]); const missed = modules.filter(it => !(tested.has(it) || tested.has(it.replace(/^esnext\./, 'es.')) || ignore.has(it))); diff --git a/tests/entries/content.mjs b/tests/entries/content.mjs index f03f7136c44a..45ca1cb7969a 100644 --- a/tests/entries/content.mjs +++ b/tests/entries/content.mjs @@ -126,7 +126,6 @@ superset('core-js/full/url', /^web\.url(?:\.|$)/); superset('core-js/full/url-search-params', /^web\.url-search-params/); superset('core-js/full/weak-map', /^(?:es|esnext)\.weak-map/); superset('core-js/full/weak-set', /^(?:es|esnext)\.weak-set/); -subset('core-js/stage/pre', /^(?:es\.|esnext\.)/); subset('core-js/stage/0', /^(?:es\.|esnext\.)/); subset('core-js/stage/1', /^(?:es\.|esnext\.)/); subset('core-js/stage/2', /^es\.|esnext\./); diff --git a/tests/entries/unit.mjs b/tests/entries/unit.mjs index 60d0e13a2133..c1d2edbb7207 100644 --- a/tests/entries/unit.mjs +++ b/tests/entries/unit.mjs @@ -732,15 +732,6 @@ for (PATH of ['@core-js/pure', 'core-js']) { ok(load(NS, 'map/some')(new Map([[1, 2], [2, 3], [3, 4]]), it => it % 2) === true); ok(load(NS, 'map/update')(new Map([[1, 2]]), 1, it => it * 2).get(1) === 4); ok(load(NS, 'number/from-string')('12', 3) === 5); - ok(typeof load(NS, 'reflect/define-metadata') == 'function'); - ok(typeof load(NS, 'reflect/delete-metadata') == 'function'); - ok(typeof load(NS, 'reflect/get-metadata') == 'function'); - ok(typeof load(NS, 'reflect/get-metadata-keys') == 'function'); - ok(typeof load(NS, 'reflect/get-own-metadata') == 'function'); - ok(typeof load(NS, 'reflect/get-own-metadata-keys') == 'function'); - ok(typeof load(NS, 'reflect/has-metadata') == 'function'); - ok(typeof load(NS, 'reflect/has-own-metadata') == 'function'); - ok(typeof load(NS, 'reflect/metadata') == 'function'); ok(load(NS, 'regexp/escape')('10$') === '\\x310\\$'); ok(load(NS, 'set/add-all')(new Set([1, 2, 3]), 4, 5).size === 5); ok(load(NS, 'set/delete-all')(new Set([1, 2, 3]), 4, 5) === false); @@ -835,7 +826,6 @@ for (PATH of ['@core-js/pure', 'core-js']) { load('proposals/promise-any'); load('proposals/promise-finally'); load('proposals/promise-with-resolvers'); - load('proposals/reflect-metadata'); load('proposals/regexp-dotall-flag'); load('proposals/regexp-escaping'); load('proposals/regexp-named-groups'); @@ -858,7 +848,6 @@ for (PATH of ['@core-js/pure', 'core-js']) { load('stage/2'); load('stage/1'); load('stage/0'); - load('stage/pre'); for (const key in entries) { if (key.startsWith('core-js/modules/')) { diff --git a/tests/unit-global/esnext.reflect.define-metadata.js b/tests/unit-global/esnext.reflect.define-metadata.js deleted file mode 100644 index 7bc87e0d7488..000000000000 --- a/tests/unit-global/esnext.reflect.define-metadata.js +++ /dev/null @@ -1,11 +0,0 @@ -QUnit.test('Reflect.defineMetadata', assert => { - const { defineMetadata } = Reflect; - assert.isFunction(defineMetadata); - assert.arity(defineMetadata, 3); - assert.name(defineMetadata, 'defineMetadata'); - assert.looksNative(defineMetadata); - assert.nonEnumerable(Reflect, 'defineMetadata'); - assert.throws(() => defineMetadata('key', 'value', undefined, undefined), TypeError); - assert.same(defineMetadata('key', 'value', {}, undefined), undefined); - assert.same(defineMetadata('key', 'value', {}, 'name'), undefined); -}); diff --git a/tests/unit-global/esnext.reflect.delete-metadata.js b/tests/unit-global/esnext.reflect.delete-metadata.js deleted file mode 100644 index a5136cc20611..000000000000 --- a/tests/unit-global/esnext.reflect.delete-metadata.js +++ /dev/null @@ -1,21 +0,0 @@ -QUnit.test('Reflect.deleteMetadata', assert => { - const { defineMetadata, hasOwnMetadata, deleteMetadata } = Reflect; - const { create } = Object; - assert.isFunction(deleteMetadata); - assert.arity(deleteMetadata, 2); - assert.name(deleteMetadata, 'deleteMetadata'); - assert.looksNative(deleteMetadata); - assert.nonEnumerable(Reflect, 'deleteMetadata'); - assert.throws(() => deleteMetadata('key', undefined, undefined), TypeError); - assert.false(deleteMetadata('key', {}, undefined)); - let object = {}; - defineMetadata('key', 'value', object, undefined); - assert.true(deleteMetadata('key', object, undefined)); - const prototype = {}; - defineMetadata('key', 'value', prototype, undefined); - assert.false(deleteMetadata('key', create(prototype), undefined)); - object = {}; - defineMetadata('key', 'value', object, undefined); - deleteMetadata('key', object, undefined); - assert.false(hasOwnMetadata('key', object, undefined)); -}); diff --git a/tests/unit-global/esnext.reflect.get-metadata-keys.js b/tests/unit-global/esnext.reflect.get-metadata-keys.js deleted file mode 100644 index b7e02fa8ad4d..000000000000 --- a/tests/unit-global/esnext.reflect.get-metadata-keys.js +++ /dev/null @@ -1,53 +0,0 @@ -QUnit.test('Reflect.getMetadataKeys', assert => { - const { defineMetadata, getMetadataKeys } = Reflect; - const { create } = Object; - assert.isFunction(getMetadataKeys); - assert.arity(getMetadataKeys, 1); - assert.name(getMetadataKeys, 'getMetadataKeys'); - assert.looksNative(getMetadataKeys); - assert.nonEnumerable(Reflect, 'getMetadataKeys'); - assert.throws(() => getMetadataKeys(undefined, undefined), TypeError); - assert.deepEqual(getMetadataKeys({}, undefined), []); - let object = {}; - defineMetadata('key', 'value', object, undefined); - assert.deepEqual(getMetadataKeys(object, undefined), ['key']); - let prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, undefined); - assert.deepEqual(getMetadataKeys(object, undefined), ['key']); - object = {}; - defineMetadata('key0', 'value', object, undefined); - defineMetadata('key1', 'value', object, undefined); - assert.deepEqual(getMetadataKeys(object, undefined), ['key0', 'key1']); - object = {}; - defineMetadata('key0', 'value', object, undefined); - defineMetadata('key1', 'value', object, undefined); - defineMetadata('key0', 'value', object, undefined); - assert.deepEqual(getMetadataKeys(object, undefined), ['key0', 'key1']); - prototype = {}; - defineMetadata('key2', 'value', prototype, undefined); - object = create(prototype); - defineMetadata('key0', 'value', object, undefined); - defineMetadata('key1', 'value', object, undefined); - assert.deepEqual(getMetadataKeys(object, undefined), ['key0', 'key1', 'key2']); - object = {}; - assert.deepEqual(getMetadataKeys({}, 'name'), []); - object = {}; - defineMetadata('key', 'value', object, 'name'); - assert.deepEqual(getMetadataKeys(object, 'name'), ['key']); - prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, 'name'); - assert.deepEqual(getMetadataKeys(object, 'name'), ['key']); - object = {}; - defineMetadata('key0', 'value', object, 'name'); - defineMetadata('key1', 'value', object, 'name'); - defineMetadata('key0', 'value', object, 'name'); - assert.deepEqual(getMetadataKeys(object, 'name'), ['key0', 'key1']); - prototype = {}; - defineMetadata('key2', 'value', prototype, 'name'); - object = create(prototype); - defineMetadata('key0', 'value', object, 'name'); - defineMetadata('key1', 'value', object, 'name'); - assert.deepEqual(getMetadataKeys(object, 'name'), ['key0', 'key1', 'key2']); -}); diff --git a/tests/unit-global/esnext.reflect.get-metadata.js b/tests/unit-global/esnext.reflect.get-metadata.js deleted file mode 100644 index 9452aae6a00d..000000000000 --- a/tests/unit-global/esnext.reflect.get-metadata.js +++ /dev/null @@ -1,26 +0,0 @@ -QUnit.test('Reflect.getMetadata', assert => { - const { defineMetadata, getMetadata } = Reflect; - const { create } = Object; - assert.isFunction(getMetadata); - assert.arity(getMetadata, 2); - assert.name(getMetadata, 'getMetadata'); - assert.looksNative(getMetadata); - assert.nonEnumerable(Reflect, 'getMetadata'); - assert.throws(() => getMetadata('key', undefined, undefined), TypeError); - assert.same(getMetadata('key', {}, undefined), undefined); - let object = {}; - defineMetadata('key', 'value', object, undefined); - assert.same(getMetadata('key', object, undefined), 'value'); - let prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, undefined); - assert.same(getMetadata('key', object, undefined), 'value'); - assert.same(getMetadata('key', {}, 'name'), undefined); - object = {}; - defineMetadata('key', 'value', object, 'name'); - assert.same(getMetadata('key', object, 'name'), 'value'); - prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, 'name'); - assert.same(getMetadata('key', object, 'name'), 'value'); -}); diff --git a/tests/unit-global/esnext.reflect.get-own-matadata.js b/tests/unit-global/esnext.reflect.get-own-matadata.js deleted file mode 100644 index a876a2c377cb..000000000000 --- a/tests/unit-global/esnext.reflect.get-own-matadata.js +++ /dev/null @@ -1,26 +0,0 @@ -QUnit.test('Reflect.getOwnMetadata', assert => { - const { defineMetadata, getOwnMetadata } = Reflect; - const { create } = Object; - assert.isFunction(getOwnMetadata); - assert.arity(getOwnMetadata, 2); - assert.name(getOwnMetadata, 'getOwnMetadata'); - assert.looksNative(getOwnMetadata); - assert.nonEnumerable(Reflect, 'getOwnMetadata'); - assert.throws(() => getOwnMetadata('key', undefined, undefined), TypeError); - assert.same(getOwnMetadata('key', {}, undefined), undefined); - let object = {}; - defineMetadata('key', 'value', object, undefined); - assert.same(getOwnMetadata('key', object, undefined), 'value'); - let prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, undefined); - assert.same(getOwnMetadata('key', object, undefined), undefined); - assert.same(getOwnMetadata('key', {}, 'name'), undefined); - object = {}; - defineMetadata('key', 'value', object, 'name'); - assert.same(getOwnMetadata('key', object, 'name'), 'value'); - prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, 'name'); - assert.same(getOwnMetadata('key', object, 'name'), undefined); -}); diff --git a/tests/unit-global/esnext.reflect.get-own-metadata-keys.js b/tests/unit-global/esnext.reflect.get-own-metadata-keys.js deleted file mode 100644 index 35a53099e400..000000000000 --- a/tests/unit-global/esnext.reflect.get-own-metadata-keys.js +++ /dev/null @@ -1,53 +0,0 @@ -QUnit.test('Reflect.getOwnMetadataKeys', assert => { - const { defineMetadata, getOwnMetadataKeys } = Reflect; - const { create } = Object; - assert.isFunction(getOwnMetadataKeys); - assert.arity(getOwnMetadataKeys, 1); - assert.name(getOwnMetadataKeys, 'getOwnMetadataKeys'); - assert.looksNative(getOwnMetadataKeys); - assert.nonEnumerable(Reflect, 'getOwnMetadataKeys'); - assert.throws(() => getOwnMetadataKeys(undefined, undefined), TypeError); - assert.deepEqual(getOwnMetadataKeys({}, undefined), []); - let object = {}; - defineMetadata('key', 'value', object, undefined); - assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key']); - let prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, undefined); - assert.deepEqual(getOwnMetadataKeys(object, undefined), []); - object = {}; - defineMetadata('key0', 'value', object, undefined); - defineMetadata('key1', 'value', object, undefined); - assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key0', 'key1']); - object = {}; - defineMetadata('key0', 'value', object, undefined); - defineMetadata('key1', 'value', object, undefined); - defineMetadata('key0', 'value', object, undefined); - assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key0', 'key1']); - prototype = {}; - defineMetadata('key2', 'value', prototype, undefined); - object = create(prototype); - defineMetadata('key0', 'value', object, undefined); - defineMetadata('key1', 'value', object, undefined); - assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key0', 'key1']); - object = {}; - assert.deepEqual(getOwnMetadataKeys({}, 'name'), []); - object = {}; - defineMetadata('key', 'value', object, 'name'); - assert.deepEqual(getOwnMetadataKeys(object, 'name'), ['key']); - prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, 'name'); - assert.deepEqual(getOwnMetadataKeys(object, 'name'), []); - object = {}; - defineMetadata('key0', 'value', object, 'name'); - defineMetadata('key1', 'value', object, 'name'); - defineMetadata('key0', 'value', object, 'name'); - assert.deepEqual(getOwnMetadataKeys(object, 'name'), ['key0', 'key1']); - prototype = {}; - defineMetadata('key2', 'value', prototype, 'name'); - object = create(prototype); - defineMetadata('key0', 'value', object, 'name'); - defineMetadata('key1', 'value', object, 'name'); - assert.deepEqual(getOwnMetadataKeys(object, 'name'), ['key0', 'key1']); -}); diff --git a/tests/unit-global/esnext.reflect.has-metadata.js b/tests/unit-global/esnext.reflect.has-metadata.js deleted file mode 100644 index 5961daef234c..000000000000 --- a/tests/unit-global/esnext.reflect.has-metadata.js +++ /dev/null @@ -1,26 +0,0 @@ -QUnit.test('Reflect.hasMetadata', assert => { - const { defineMetadata, hasMetadata } = Reflect; - const { create } = Object; - assert.isFunction(hasMetadata); - assert.arity(hasMetadata, 2); - assert.name(hasMetadata, 'hasMetadata'); - assert.looksNative(hasMetadata); - assert.nonEnumerable(Reflect, 'hasMetadata'); - assert.throws(() => hasMetadata('key', undefined, undefined), TypeError); - assert.false(hasMetadata('key', {}, undefined)); - let object = {}; - defineMetadata('key', 'value', object, undefined); - assert.true(hasMetadata('key', object, undefined)); - let prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, undefined); - assert.true(hasMetadata('key', object, undefined)); - assert.false(hasMetadata('key', {}, 'name')); - object = {}; - defineMetadata('key', 'value', object, 'name'); - assert.true(hasMetadata('key', object, 'name')); - prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, 'name'); - assert.true(hasMetadata('key', object, 'name')); -}); diff --git a/tests/unit-global/esnext.reflect.has-own-metadata.js b/tests/unit-global/esnext.reflect.has-own-metadata.js deleted file mode 100644 index af5848ea8cf1..000000000000 --- a/tests/unit-global/esnext.reflect.has-own-metadata.js +++ /dev/null @@ -1,26 +0,0 @@ -QUnit.test('Reflect.hasOwnMetadata', assert => { - const { defineMetadata, hasOwnMetadata } = Reflect; - const { create } = Object; - assert.isFunction(hasOwnMetadata); - assert.arity(hasOwnMetadata, 2); - assert.name(hasOwnMetadata, 'hasOwnMetadata'); - assert.looksNative(hasOwnMetadata); - assert.nonEnumerable(Reflect, 'hasOwnMetadata'); - assert.throws(() => hasOwnMetadata('key', undefined, undefined), TypeError); - assert.false(hasOwnMetadata('key', {}, undefined)); - let object = {}; - defineMetadata('key', 'value', object, undefined); - assert.true(hasOwnMetadata('key', object, undefined)); - let prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, undefined); - assert.false(hasOwnMetadata('key', object, undefined)); - assert.false(hasOwnMetadata('key', {}, 'name')); - object = {}; - defineMetadata('key', 'value', object, 'name'); - assert.true(hasOwnMetadata('key', object, 'name')); - prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, 'name'); - assert.false(hasOwnMetadata('key', object, 'name')); -}); diff --git a/tests/unit-global/esnext.reflect.metadata.js b/tests/unit-global/esnext.reflect.metadata.js deleted file mode 100644 index e10d5c7308c8..000000000000 --- a/tests/unit-global/esnext.reflect.metadata.js +++ /dev/null @@ -1,17 +0,0 @@ -QUnit.test('Reflect.metadata', assert => { - const { metadata, hasOwnMetadata } = Reflect; - assert.isFunction(metadata); - assert.arity(metadata, 2); - assert.name(metadata, 'metadata'); - assert.looksNative(metadata); - assert.isFunction(metadata('key', 'value')); - assert.nonEnumerable(Reflect, 'metadata'); - const decorator = metadata('key', 'value'); - assert.throws(() => decorator(undefined, 'name'), TypeError); - let target = function () { /* empty */ }; - decorator(target); - assert.true(hasOwnMetadata('key', target, undefined)); - target = {}; - decorator(target, 'name'); - assert.true(hasOwnMetadata('key', target, 'name')); -}); diff --git a/tests/unit-pure/esnext.reflect.define-metadata.js b/tests/unit-pure/esnext.reflect.define-metadata.js deleted file mode 100644 index 576ae63dfe5b..000000000000 --- a/tests/unit-pure/esnext.reflect.define-metadata.js +++ /dev/null @@ -1,9 +0,0 @@ -import defineMetadata from '@core-js/pure/full/reflect/define-metadata'; - -QUnit.test('Reflect.defineMetadata', assert => { - assert.isFunction(defineMetadata); - assert.arity(defineMetadata, 3); - assert.throws(() => defineMetadata('key', 'value', undefined, undefined), TypeError); - assert.same(defineMetadata('key', 'value', {}, undefined), undefined); - assert.same(defineMetadata('key', 'value', {}, 'name'), undefined); -}); diff --git a/tests/unit-pure/esnext.reflect.delete-metadata.js b/tests/unit-pure/esnext.reflect.delete-metadata.js deleted file mode 100644 index 1d2c8e4021b9..000000000000 --- a/tests/unit-pure/esnext.reflect.delete-metadata.js +++ /dev/null @@ -1,21 +0,0 @@ -import create from '@core-js/pure/full/object/create'; -import defineMetadata from '@core-js/pure/full/reflect/define-metadata'; -import hasOwnMetadata from '@core-js/pure/full/reflect/has-own-metadata'; -import deleteMetadata from '@core-js/pure/full/reflect/delete-metadata'; - -QUnit.test('Reflect.deleteMetadata', assert => { - assert.isFunction(deleteMetadata); - assert.arity(deleteMetadata, 2); - assert.throws(() => deleteMetadata('key', undefined, undefined), TypeError); - assert.false(deleteMetadata('key', {}, undefined)); - let object = {}; - defineMetadata('key', 'value', object, undefined); - assert.true(deleteMetadata('key', object, undefined)); - const prototype = {}; - defineMetadata('key', 'value', prototype, undefined); - assert.false(deleteMetadata('key', create(prototype), undefined)); - object = {}; - defineMetadata('key', 'value', object, undefined); - deleteMetadata('key', object, undefined); - assert.false(hasOwnMetadata('key', object, undefined)); -}); diff --git a/tests/unit-pure/esnext.reflect.get-metadata-keys.js b/tests/unit-pure/esnext.reflect.get-metadata-keys.js deleted file mode 100644 index 298c5fd79515..000000000000 --- a/tests/unit-pure/esnext.reflect.get-metadata-keys.js +++ /dev/null @@ -1,52 +0,0 @@ -import create from '@core-js/pure/full/object/create'; -import defineMetadata from '@core-js/pure/full/reflect/define-metadata'; -import getMetadataKeys from '@core-js/pure/full/reflect/get-metadata-keys'; - -QUnit.test('Reflect.getMetadataKeys', assert => { - assert.isFunction(getMetadataKeys); - assert.arity(getMetadataKeys, 1); - assert.throws(() => getMetadataKeys(undefined, undefined), TypeError); - assert.deepEqual(getMetadataKeys({}, undefined), []); - let object = {}; - defineMetadata('key', 'value', object, undefined); - assert.deepEqual(getMetadataKeys(object, undefined), ['key']); - let prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, undefined); - assert.deepEqual(getMetadataKeys(object, undefined), ['key']); - object = {}; - defineMetadata('key0', 'value', object, undefined); - defineMetadata('key1', 'value', object, undefined); - assert.deepEqual(getMetadataKeys(object, undefined), ['key0', 'key1']); - object = {}; - defineMetadata('key0', 'value', object, undefined); - defineMetadata('key1', 'value', object, undefined); - defineMetadata('key0', 'value', object, undefined); - assert.deepEqual(getMetadataKeys(object, undefined), ['key0', 'key1']); - prototype = {}; - defineMetadata('key2', 'value', prototype, undefined); - object = create(prototype); - defineMetadata('key0', 'value', object, undefined); - defineMetadata('key1', 'value', object, undefined); - assert.deepEqual(getMetadataKeys(object, undefined), ['key0', 'key1', 'key2']); - object = {}; - assert.deepEqual(getMetadataKeys({}, 'name'), []); - object = {}; - defineMetadata('key', 'value', object, 'name'); - assert.deepEqual(getMetadataKeys(object, 'name'), ['key']); - prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, 'name'); - assert.deepEqual(getMetadataKeys(object, 'name'), ['key']); - object = {}; - defineMetadata('key0', 'value', object, 'name'); - defineMetadata('key1', 'value', object, 'name'); - defineMetadata('key0', 'value', object, 'name'); - assert.deepEqual(getMetadataKeys(object, 'name'), ['key0', 'key1']); - prototype = {}; - defineMetadata('key2', 'value', prototype, 'name'); - object = create(prototype); - defineMetadata('key0', 'value', object, 'name'); - defineMetadata('key1', 'value', object, 'name'); - assert.deepEqual(getMetadataKeys(object, 'name'), ['key0', 'key1', 'key2']); -}); diff --git a/tests/unit-pure/esnext.reflect.get-metadata.js b/tests/unit-pure/esnext.reflect.get-metadata.js deleted file mode 100644 index c3e8310720b8..000000000000 --- a/tests/unit-pure/esnext.reflect.get-metadata.js +++ /dev/null @@ -1,25 +0,0 @@ -import create from '@core-js/pure/full/object/create'; -import defineMetadata from '@core-js/pure/full/reflect/define-metadata'; -import getMetadata from '@core-js/pure/full/reflect/get-metadata'; - -QUnit.test('Reflect.getMetadata', assert => { - assert.isFunction(getMetadata); - assert.arity(getMetadata, 2); - assert.throws(() => getMetadata('key', undefined, undefined), TypeError); - assert.same(getMetadata('key', {}, undefined), undefined); - let object = {}; - defineMetadata('key', 'value', object, undefined); - assert.same(getMetadata('key', object, undefined), 'value'); - let prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, undefined); - assert.same(getMetadata('key', object, undefined), 'value'); - assert.same(getMetadata('key', {}, 'name'), undefined); - object = {}; - defineMetadata('key', 'value', object, 'name'); - assert.same(getMetadata('key', object, 'name'), 'value'); - prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, 'name'); - assert.same(getMetadata('key', object, 'name'), 'value'); -}); diff --git a/tests/unit-pure/esnext.reflect.get-own-matadata.js b/tests/unit-pure/esnext.reflect.get-own-matadata.js deleted file mode 100644 index 61c23cd857e9..000000000000 --- a/tests/unit-pure/esnext.reflect.get-own-matadata.js +++ /dev/null @@ -1,25 +0,0 @@ -import create from '@core-js/pure/full/object/create'; -import defineMetadata from '@core-js/pure/full/reflect/define-metadata'; -import getOwnMetadata from '@core-js/pure/full/reflect/get-own-metadata'; - -QUnit.test('Reflect.getOwnMetadata', assert => { - assert.isFunction(getOwnMetadata); - assert.arity(getOwnMetadata, 2); - assert.throws(() => getOwnMetadata('key', undefined, undefined), TypeError); - assert.same(getOwnMetadata('key', {}, undefined), undefined); - let object = {}; - defineMetadata('key', 'value', object, undefined); - assert.same(getOwnMetadata('key', object, undefined), 'value'); - let prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, undefined); - assert.same(getOwnMetadata('key', object, undefined), undefined); - assert.same(getOwnMetadata('key', {}, 'name'), undefined); - object = {}; - defineMetadata('key', 'value', object, 'name'); - assert.same(getOwnMetadata('key', object, 'name'), 'value'); - prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, 'name'); - assert.same(getOwnMetadata('key', object, 'name'), undefined); -}); diff --git a/tests/unit-pure/esnext.reflect.get-own-metadata-keys.js b/tests/unit-pure/esnext.reflect.get-own-metadata-keys.js deleted file mode 100644 index bd0c007c24de..000000000000 --- a/tests/unit-pure/esnext.reflect.get-own-metadata-keys.js +++ /dev/null @@ -1,52 +0,0 @@ -import create from '@core-js/pure/full/object/create'; -import defineMetadata from '@core-js/pure/full/reflect/define-metadata'; -import getOwnMetadataKeys from '@core-js/pure/full/reflect/get-own-metadata-keys'; - -QUnit.test('Reflect.getOwnMetadataKeys', assert => { - assert.isFunction(getOwnMetadataKeys); - assert.arity(getOwnMetadataKeys, 1); - assert.throws(() => getOwnMetadataKeys(undefined, undefined), TypeError); - assert.deepEqual(getOwnMetadataKeys({}, undefined), []); - let object = {}; - defineMetadata('key', 'value', object, undefined); - assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key']); - let prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, undefined); - assert.deepEqual(getOwnMetadataKeys(object, undefined), []); - object = {}; - defineMetadata('key0', 'value', object, undefined); - defineMetadata('key1', 'value', object, undefined); - assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key0', 'key1']); - object = {}; - defineMetadata('key0', 'value', object, undefined); - defineMetadata('key1', 'value', object, undefined); - defineMetadata('key0', 'value', object, undefined); - assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key0', 'key1']); - prototype = {}; - defineMetadata('key2', 'value', prototype, undefined); - object = create(prototype); - defineMetadata('key0', 'value', object, undefined); - defineMetadata('key1', 'value', object, undefined); - assert.deepEqual(getOwnMetadataKeys(object, undefined), ['key0', 'key1']); - object = {}; - assert.deepEqual(getOwnMetadataKeys({}, 'name'), []); - object = {}; - defineMetadata('key', 'value', object, 'name'); - assert.deepEqual(getOwnMetadataKeys(object, 'name'), ['key']); - prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, 'name'); - assert.deepEqual(getOwnMetadataKeys(object, 'name'), []); - object = {}; - defineMetadata('key0', 'value', object, 'name'); - defineMetadata('key1', 'value', object, 'name'); - defineMetadata('key0', 'value', object, 'name'); - assert.deepEqual(getOwnMetadataKeys(object, 'name'), ['key0', 'key1']); - prototype = {}; - defineMetadata('key2', 'value', prototype, 'name'); - object = create(prototype); - defineMetadata('key0', 'value', object, 'name'); - defineMetadata('key1', 'value', object, 'name'); - assert.deepEqual(getOwnMetadataKeys(object, 'name'), ['key0', 'key1']); -}); diff --git a/tests/unit-pure/esnext.reflect.has-metadata.js b/tests/unit-pure/esnext.reflect.has-metadata.js deleted file mode 100644 index 385d20d8c909..000000000000 --- a/tests/unit-pure/esnext.reflect.has-metadata.js +++ /dev/null @@ -1,25 +0,0 @@ -import create from '@core-js/pure/full/object/create'; -import defineMetadata from '@core-js/pure/full/reflect/define-metadata'; -import hasMetadata from '@core-js/pure/full/reflect/has-metadata'; - -QUnit.test('Reflect.hasMetadata', assert => { - assert.isFunction(hasMetadata); - assert.arity(hasMetadata, 2); - assert.throws(() => hasMetadata('key', undefined, undefined), TypeError); - assert.false(hasMetadata('key', {}, undefined)); - let object = {}; - defineMetadata('key', 'value', object, undefined); - assert.true(hasMetadata('key', object, undefined)); - let prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, undefined); - assert.true(hasMetadata('key', object, undefined)); - assert.false(hasMetadata('key', {}, 'name')); - object = {}; - defineMetadata('key', 'value', object, 'name'); - assert.true(hasMetadata('key', object, 'name')); - prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, 'name'); - assert.true(hasMetadata('key', object, 'name')); -}); diff --git a/tests/unit-pure/esnext.reflect.has-own-metadata.js b/tests/unit-pure/esnext.reflect.has-own-metadata.js deleted file mode 100644 index b9c65e8627dc..000000000000 --- a/tests/unit-pure/esnext.reflect.has-own-metadata.js +++ /dev/null @@ -1,25 +0,0 @@ -import create from '@core-js/pure/full/object/create'; -import defineMetadata from '@core-js/pure/full/reflect/define-metadata'; -import hasOwnMetadata from '@core-js/pure/full/reflect/has-own-metadata'; - -QUnit.test('Reflect.hasOwnMetadata', assert => { - assert.isFunction(hasOwnMetadata); - assert.arity(hasOwnMetadata, 2); - assert.throws(() => hasOwnMetadata('key', undefined, undefined), TypeError); - assert.false(hasOwnMetadata('key', {}, undefined)); - let object = {}; - defineMetadata('key', 'value', object, undefined); - assert.true(hasOwnMetadata('key', object, undefined)); - let prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, undefined); - assert.false(hasOwnMetadata('key', object, undefined)); - assert.false(hasOwnMetadata('key', {}, 'name')); - object = {}; - defineMetadata('key', 'value', object, 'name'); - assert.true(hasOwnMetadata('key', object, 'name')); - prototype = {}; - object = create(prototype); - defineMetadata('key', 'value', prototype, 'name'); - assert.false(hasOwnMetadata('key', object, 'name')); -}); diff --git a/tests/unit-pure/esnext.reflect.metadata.js b/tests/unit-pure/esnext.reflect.metadata.js deleted file mode 100644 index f509736ab9a5..000000000000 --- a/tests/unit-pure/esnext.reflect.metadata.js +++ /dev/null @@ -1,16 +0,0 @@ -import hasOwnMetadata from '@core-js/pure/full/reflect/has-own-metadata'; -import metadata from '@core-js/pure/full/reflect/metadata'; - -QUnit.test('Reflect.metadata', assert => { - assert.isFunction(metadata); - assert.arity(metadata, 2); - assert.isFunction(metadata('key', 'value')); - const decorator = metadata('key', 'value'); - assert.throws(() => decorator(undefined, 'name'), TypeError); - let target = function () { /* empty */ }; - decorator(target); - assert.true(hasOwnMetadata('key', target, undefined)); - target = {}; - decorator(target, 'name'); - assert.true(hasOwnMetadata('key', target, 'name')); -});