|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 2 weeks ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
589 bytes
|
| Line | |
|---|
| 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | var hasOwn = require('hasown');
|
|---|
| 4 |
|
|---|
| 5 | var hasUnscopables = typeof Symbol === 'function' && typeof Symbol.unscopables === 'symbol';
|
|---|
| 6 |
|
|---|
| 7 | var map = hasUnscopables && Array.prototype[Symbol.unscopables];
|
|---|
| 8 |
|
|---|
| 9 | var $TypeError = TypeError;
|
|---|
| 10 |
|
|---|
| 11 | /** @type {import('.')} */
|
|---|
| 12 | module.exports = function shimUnscopables(method) {
|
|---|
| 13 | if (typeof method !== 'string' || !method) {
|
|---|
| 14 | throw new $TypeError('method must be a non-empty string');
|
|---|
| 15 | }
|
|---|
| 16 | if (!hasOwn(Array.prototype, method)) {
|
|---|
| 17 | throw new $TypeError('method must be on Array.prototype');
|
|---|
| 18 | }
|
|---|
| 19 | if (hasUnscopables && map) {
|
|---|
| 20 | map[method] = true;
|
|---|
| 21 | }
|
|---|
| 22 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.