X-Git-Url: https://git.josue.xyz/?p=dotfiles%2F.git;a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fnode_modules%2Fcoc-prettier%2Fnode_modules%2Fcore-js%2Finternals%2Farray-unique-by.js;h=f79cebbe7fef54b74e887039abcaa0f468e3079c;hp=d470d4013750740476a881f7d270b94b481b2436;hb=3be0a9efc698a9570a44456009afc6014812625a;hpb=d2f432cc757f42f0318fdddcab8c00b240d47088 diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/core-js/internals/array-unique-by.js b/.config/coc/extensions/node_modules/coc-prettier/node_modules/core-js/internals/array-unique-by.js index d470d401..f79cebbe 100644 --- a/.config/coc/extensions/node_modules/coc-prettier/node_modules/core-js/internals/array-unique-by.js +++ b/.config/coc/extensions/node_modules/coc-prettier/node_modules/core-js/internals/array-unique-by.js @@ -1,32 +1,36 @@ 'use strict'; -var toLength = require('../internals/to-length'); -var toObject = require('../internals/to-object'); var getBuiltIn = require('../internals/get-built-in'); +var uncurryThis = require('../internals/function-uncurry-this'); +var aCallable = require('../internals/a-callable'); +var lengthOfArrayLike = require('../internals/length-of-array-like'); +var toObject = require('../internals/to-object'); var arraySpeciesCreate = require('../internals/array-species-create'); -var push = [].push; +var Map = getBuiltIn('Map'); +var MapPrototype = Map.prototype; +var mapForEach = uncurryThis(MapPrototype.forEach); +var mapHas = uncurryThis(MapPrototype.has); +var mapSet = uncurryThis(MapPrototype.set); +var push = uncurryThis([].push); // `Array.prototype.uniqueBy` method // https://github.com/tc39/proposal-array-unique module.exports = function uniqueBy(resolver) { var that = toObject(this); - var length = toLength(that.length); + var length = lengthOfArrayLike(that); var result = arraySpeciesCreate(that, 0); - var Map = getBuiltIn('Map'); var map = new Map(); - var resolverFunction, index, item, key; - if (typeof resolver == 'function') resolverFunction = resolver; - else if (resolver == null) resolverFunction = function (value) { + var resolverFunction = resolver != null ? aCallable(resolver) : function (value) { return value; }; - else throw new TypeError('Incorrect resolver!'); + var index, item, key; for (index = 0; index < length; index++) { item = that[index]; key = resolverFunction(item); - if (!map.has(key)) map.set(key, item); + if (!mapHas(map, key)) mapSet(map, key, item); } - map.forEach(function (value) { - push.call(result, value); + mapForEach(map, function (value) { + push(result, value); }); return result; };