X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;ds=sidebyside;f=.config%2Fcoc%2Fextensions%2Fnode_modules%2Fcoc-prettier%2Fnode_modules%2Fcore-js%2Finternals%2Ftyped-array-constructor.js;h=c271b1a12a998034f54752c7dd877efa19d6d4d2;hb=3be0a9efc698a9570a44456009afc6014812625a;hp=61ef391c1b485dbd5ba5fe9a40a9b50dc9898c5d;hpb=d2f432cc757f42f0318fdddcab8c00b240d47088;p=dotfiles%2F.git diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/core-js/internals/typed-array-constructor.js b/.config/coc/extensions/node_modules/coc-prettier/node_modules/core-js/internals/typed-array-constructor.js index 61ef391c..c271b1a1 100644 --- a/.config/coc/extensions/node_modules/coc-prettier/node_modules/core-js/internals/typed-array-constructor.js +++ b/.config/coc/extensions/node_modules/coc-prettier/node_modules/core-js/internals/typed-array-constructor.js @@ -1,6 +1,7 @@ 'use strict'; var $ = require('../internals/export'); var global = require('../internals/global'); +var call = require('../internals/function-call'); var DESCRIPTORS = require('../internals/descriptors'); var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = require('../internals/typed-array-constructors-require-wrappers'); var ArrayBufferViewCore = require('../internals/array-buffer-view-core'); @@ -8,14 +9,17 @@ var ArrayBufferModule = require('../internals/array-buffer'); var anInstance = require('../internals/an-instance'); var createPropertyDescriptor = require('../internals/create-property-descriptor'); var createNonEnumerableProperty = require('../internals/create-non-enumerable-property'); +var isIntegralNumber = require('../internals/is-integral-number'); var toLength = require('../internals/to-length'); var toIndex = require('../internals/to-index'); var toOffset = require('../internals/to-offset'); -var toPrimitive = require('../internals/to-primitive'); -var has = require('../internals/has'); +var toPropertyKey = require('../internals/to-property-key'); +var hasOwn = require('../internals/has-own-property'); var classof = require('../internals/classof'); var isObject = require('../internals/is-object'); +var isSymbol = require('../internals/is-symbol'); var create = require('../internals/object-create'); +var isPrototypeOf = require('../internals/object-is-prototype-of'); var setPrototypeOf = require('../internals/object-set-prototype-of'); var getOwnPropertyNames = require('../internals/object-get-own-property-names').f; var typedArrayFrom = require('../internals/typed-array-from'); @@ -33,8 +37,10 @@ var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; var round = Math.round; var RangeError = global.RangeError; var ArrayBuffer = ArrayBufferModule.ArrayBuffer; +var ArrayBufferPrototype = ArrayBuffer.prototype; var DataView = ArrayBufferModule.DataView; var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS; +var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR; var TYPED_ARRAY_TAG = ArrayBufferViewCore.TYPED_ARRAY_TAG; var TypedArray = ArrayBufferViewCore.TypedArray; var TypedArrayPrototype = ArrayBufferViewCore.TypedArrayPrototype; @@ -44,9 +50,10 @@ var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT'; var WRONG_LENGTH = 'Wrong length'; var fromList = function (C, list) { + aTypedArrayConstructor(C); var index = 0; var length = list.length; - var result = new (aTypedArrayConstructor(C))(length); + var result = new C(length); while (length > index) result[index] = list[index++]; return result; }; @@ -59,32 +66,35 @@ var addGetter = function (it, key) { var isArrayBuffer = function (it) { var klass; - return it instanceof ArrayBuffer || (klass = classof(it)) == 'ArrayBuffer' || klass == 'SharedArrayBuffer'; + return isPrototypeOf(ArrayBufferPrototype, it) || (klass = classof(it)) == 'ArrayBuffer' || klass == 'SharedArrayBuffer'; }; var isTypedArrayIndex = function (target, key) { return isTypedArray(target) - && typeof key != 'symbol' + && !isSymbol(key) && key in target - && String(+key) == String(key); + && isIntegralNumber(+key) + && key >= 0; }; var wrappedGetOwnPropertyDescriptor = function getOwnPropertyDescriptor(target, key) { - return isTypedArrayIndex(target, key = toPrimitive(key, true)) + key = toPropertyKey(key); + return isTypedArrayIndex(target, key) ? createPropertyDescriptor(2, target[key]) : nativeGetOwnPropertyDescriptor(target, key); }; var wrappedDefineProperty = function defineProperty(target, key, descriptor) { - if (isTypedArrayIndex(target, key = toPrimitive(key, true)) + key = toPropertyKey(key); + if (isTypedArrayIndex(target, key) && isObject(descriptor) - && has(descriptor, 'value') - && !has(descriptor, 'get') - && !has(descriptor, 'set') + && hasOwn(descriptor, 'value') + && !hasOwn(descriptor, 'get') + && !hasOwn(descriptor, 'set') // TODO: add validation descriptor w/o calling accessors && !descriptor.configurable - && (!has(descriptor, 'writable') || descriptor.writable) - && (!has(descriptor, 'enumerable') || descriptor.enumerable) + && (!hasOwn(descriptor, 'writable') || descriptor.writable) + && (!hasOwn(descriptor, 'enumerable') || descriptor.enumerable) ) { target[key] = descriptor.value; return target; @@ -141,7 +151,7 @@ if (DESCRIPTORS) { if (!NATIVE_ARRAY_BUFFER_VIEWS) { TypedArrayConstructor = wrapper(function (that, data, offset, $length) { - anInstance(that, TypedArrayConstructor, CONSTRUCTOR_NAME); + anInstance(that, TypedArrayConstructorPrototype); var index = 0; var byteOffset = 0; var buffer, byteLength, length; @@ -165,7 +175,7 @@ if (DESCRIPTORS) { } else if (isTypedArray(data)) { return fromList(TypedArrayConstructor, data); } else { - return typedArrayFrom.call(TypedArrayConstructor, data); + return call(typedArrayFrom, TypedArrayConstructor, data); } setInternalState(that, { buffer: buffer, @@ -181,7 +191,7 @@ if (DESCRIPTORS) { TypedArrayConstructorPrototype = TypedArrayConstructor.prototype = create(TypedArrayPrototype); } else if (TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS) { TypedArrayConstructor = wrapper(function (dummy, data, typedArrayOffset, $length) { - anInstance(dummy, TypedArrayConstructor, CONSTRUCTOR_NAME); + anInstance(dummy, TypedArrayConstructorPrototype); return inheritIfRequired(function () { if (!isObject(data)) return new NativeTypedArrayConstructor(toIndex(data)); if (isArrayBuffer(data)) return $length !== undefined @@ -190,7 +200,7 @@ if (DESCRIPTORS) { ? new NativeTypedArrayConstructor(data, toOffset(typedArrayOffset, BYTES)) : new NativeTypedArrayConstructor(data); if (isTypedArray(data)) return fromList(TypedArrayConstructor, data); - return typedArrayFrom.call(TypedArrayConstructor, data); + return call(typedArrayFrom, TypedArrayConstructor, data); }(), dummy, TypedArrayConstructor); }); @@ -207,6 +217,8 @@ if (DESCRIPTORS) { createNonEnumerableProperty(TypedArrayConstructorPrototype, 'constructor', TypedArrayConstructor); } + createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_CONSTRUCTOR, TypedArrayConstructor); + if (TYPED_ARRAY_TAG) { createNonEnumerableProperty(TypedArrayConstructorPrototype, TYPED_ARRAY_TAG, CONSTRUCTOR_NAME); }