Skip to content

Commit

Permalink
drop ArraySpeciesCreate from `{ Array, %TypedArray% }.prototype.uni…
Browse files Browse the repository at this point in the history
…queBy`
  • Loading branch information
zloirock committed Dec 16, 2022
1 parent 975ba13 commit 6a9b2a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions packages/core-js/internals/array-unique-by.js
Expand Up @@ -4,7 +4,6 @@ var aCallable = require('../internals/a-callable');
var isNullOrUndefined = require('../internals/is-null-or-undefined');
var lengthOfArrayLike = require('../internals/length-of-array-like');
var toObject = require('../internals/to-object');
var arraySpeciesCreate = require('../internals/array-species-create');
var MapHelpers = require('../internals/map-helpers');
var iterate = require('../internals/map-iterate');

Expand All @@ -18,7 +17,7 @@ var push = uncurryThis([].push);
module.exports = function uniqueBy(resolver) {
var that = toObject(this);
var length = lengthOfArrayLike(that);
var result = arraySpeciesCreate(that, 0);
var result = [];
var map = new Map();
var resolverFunction = !isNullOrUndefined(resolver) ? aCallable(resolver) : function (value) {
return value;
Expand Down
5 changes: 3 additions & 2 deletions packages/core-js/modules/esnext.typed-array.unique-by.js
@@ -1,15 +1,16 @@
'use strict';
var uncurryThis = require('../internals/function-uncurry-this');
var ArrayBufferViewCore = require('../internals/array-buffer-view-core');
var arrayFromConstructorAndList = require('../internals/array-from-constructor-and-list');
var $arrayUniqueBy = require('../internals/array-unique-by');
var fromSpeciesAndList = require('../internals/typed-array-from-species-and-list');

var aTypedArray = ArrayBufferViewCore.aTypedArray;
var getTypedArrayConstructor = ArrayBufferViewCore.getTypedArrayConstructor;
var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod;
var arrayUniqueBy = uncurryThis($arrayUniqueBy);

// `%TypedArray%.prototype.uniqueBy` method
// https://github.com/tc39/proposal-array-unique
exportTypedArrayMethod('uniqueBy', function uniqueBy(resolver) {
return fromSpeciesAndList(this, arrayUniqueBy(aTypedArray(this), resolver));
return arrayFromConstructorAndList(getTypedArrayConstructor(this), arrayUniqueBy(aTypedArray(this), resolver));
}, true);

0 comments on commit 6a9b2a3

Please sign in to comment.