main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
977 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | 'use strict';
|
---|
| 2 | var $ = require('../internals/export');
|
---|
| 3 | var ReflectMetadataModule = require('../internals/reflect-metadata');
|
---|
| 4 | var anObject = require('../internals/an-object');
|
---|
| 5 |
|
---|
| 6 | var toMetadataKey = ReflectMetadataModule.toKey;
|
---|
| 7 | var getOrCreateMetadataMap = ReflectMetadataModule.getMap;
|
---|
| 8 | var store = ReflectMetadataModule.store;
|
---|
| 9 |
|
---|
| 10 | // `Reflect.deleteMetadata` method
|
---|
| 11 | // https://github.com/rbuckton/reflect-metadata
|
---|
| 12 | $({ target: 'Reflect', stat: true }, {
|
---|
| 13 | deleteMetadata: function deleteMetadata(metadataKey, target /* , targetKey */) {
|
---|
| 14 | var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]);
|
---|
| 15 | var metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false);
|
---|
| 16 | if (metadataMap === undefined || !metadataMap['delete'](metadataKey)) return false;
|
---|
| 17 | if (metadataMap.size) return true;
|
---|
| 18 | var targetMetadata = store.get(target);
|
---|
| 19 | targetMetadata['delete'](targetKey);
|
---|
| 20 | return !!targetMetadata.size || store['delete'](target);
|
---|
| 21 | }
|
---|
| 22 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.