source: imaps-frontend/node_modules/core-js/modules/esnext.array.is-template-object.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 963 bytes
Line 
1'use strict';
2var $ = require('../internals/export');
3var isArray = require('../internals/is-array');
4
5// eslint-disable-next-line es/no-object-isfrozen -- safe
6var isFrozen = Object.isFrozen;
7
8var isFrozenStringArray = function (array, allowUndefined) {
9 if (!isFrozen || !isArray(array) || !isFrozen(array)) return false;
10 var index = 0;
11 var length = array.length;
12 var element;
13 while (index < length) {
14 element = array[index++];
15 if (!(typeof element == 'string' || (allowUndefined && element === undefined))) {
16 return false;
17 }
18 } return length !== 0;
19};
20
21// `Array.isTemplateObject` method
22// https://github.com/tc39/proposal-array-is-template-object
23$({ target: 'Array', stat: true, sham: true, forced: true }, {
24 isTemplateObject: function isTemplateObject(value) {
25 if (!isFrozenStringArray(value, true)) return false;
26 var raw = value.raw;
27 return raw.length === value.length && isFrozenStringArray(raw, false);
28 }
29});
Note: See TracBrowser for help on using the repository browser.