source: imaps-frontend/node_modules/es-shim-unscopables/index.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 555 bytes
RevLine 
[d565449]1'use strict';
2
3var hasOwn = require('hasown');
4
5var hasUnscopables = typeof Symbol === 'function' && typeof Symbol.unscopables === 'symbol';
6
7var map = hasUnscopables && Array.prototype[Symbol.unscopables];
8
9var $TypeError = TypeError;
10
11module.exports = function shimUnscopables(method) {
12 if (typeof method !== 'string' || !method) {
13 throw new $TypeError('method must be a non-empty string');
14 }
15 if (!hasOwn(Array.prototype, method)) {
16 throw new $TypeError('method must be on Array.prototype');
17 }
18 if (hasUnscopables) {
19 map[method] = true;
20 }
21};
Note: See TracBrowser for help on using the repository browser.