wallet-core/node_modules/core-js/modules/es7.reflect.delete-metadata.js

16 lines
704 B
JavaScript
Raw Normal View History

2017-08-14 05:01:11 +02:00
var metadata = require('./_metadata');
var anObject = require('./_an-object');
var toMetaKey = metadata.key;
var getOrCreateMetadataMap = metadata.map;
var store = metadata.store;
2017-05-28 00:38:50 +02:00
2017-08-14 05:01:11 +02:00
metadata.exp({ deleteMetadata: function deleteMetadata(metadataKey, target /* , targetKey */) {
var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2]);
var metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false);
if (metadataMap === undefined || !metadataMap['delete'](metadataKey)) return false;
if (metadataMap.size) return true;
2017-05-28 00:38:50 +02:00
var targetMetadata = store.get(target);
targetMetadata['delete'](targetKey);
return !!targetMetadata.size || store['delete'](target);
2017-08-14 05:01:11 +02:00
} });