-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename methods from the
Array
grouping proposal
- Loading branch information
Showing
36 changed files
with
331 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require('../../modules/es.map'); | ||
require('../../modules/es.object.to-string'); | ||
require('../../modules/esnext.array.group-to-map'); | ||
var entryUnbind = require('../../internals/entry-unbind'); | ||
|
||
module.exports = entryUnbind('Array', 'groupToMap'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require('../../modules/esnext.array.group'); | ||
var entryUnbind = require('../../internals/entry-unbind'); | ||
|
||
module.exports = entryUnbind('Array', 'group'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require('../../../modules/es.map'); | ||
require('../../../modules/es.object.to-string'); | ||
require('../../../modules/esnext.array.group-to-map'); | ||
var entryVirtual = require('../../../internals/entry-virtual'); | ||
|
||
module.exports = entryVirtual('Array').groupToMap; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
require('../../../modules/esnext.array.group'); | ||
var entryVirtual = require('../../../internals/entry-virtual'); | ||
|
||
module.exports = entryVirtual('Array').group; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/group-to-map'); | ||
|
||
var ArrayPrototype = Array.prototype; | ||
|
||
module.exports = function (it) { | ||
var own = it.groupToMap; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.groupToMap) ? method : own; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
var isPrototypeOf = require('../../internals/object-is-prototype-of'); | ||
var method = require('../array/virtual/group'); | ||
|
||
var ArrayPrototype = Array.prototype; | ||
|
||
module.exports = function (it) { | ||
var own = it.group; | ||
return it === ArrayPrototype || (isPrototypeOf(ArrayPrototype, it) && own === ArrayPrototype.group) ? method : own; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../actual/array/group-to-map'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../actual/array/group'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../../actual/array/virtual/group-to-map'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../../actual/array/virtual/group'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../actual/instance/group-to-map'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var parent = require('../../actual/instance/group'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
'use strict'; | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var bind = require('../internals/function-bind-context'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var IndexedObject = require('../internals/indexed-object'); | ||
var toObject = require('../internals/to-object'); | ||
var lengthOfArrayLike = require('../internals/length-of-array-like'); | ||
|
||
var Map = getBuiltIn('Map'); | ||
var MapPrototype = Map.prototype; | ||
var mapGet = uncurryThis(MapPrototype.get); | ||
var mapHas = uncurryThis(MapPrototype.has); | ||
var mapSet = uncurryThis(MapPrototype.set); | ||
var push = uncurryThis([].push); | ||
|
||
// `Array.prototype.groupToMap` method | ||
// https://github.com/tc39/proposal-array-grouping | ||
module.exports = function groupToMap(callbackfn /* , thisArg */) { | ||
var O = toObject(this); | ||
var self = IndexedObject(O); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); | ||
var map = new Map(); | ||
var length = lengthOfArrayLike(self); | ||
var index = 0; | ||
var key, value; | ||
for (;length > index; index++) { | ||
value = self[index]; | ||
key = boundFunction(value, index, O); | ||
if (mapHas(map, key)) push(mapGet(map, key), value); | ||
else mapSet(map, key, [value]); | ||
} return map; | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,14 @@ | ||
'use strict'; | ||
// TODO: Remove from `core-js@4` | ||
var $ = require('../internals/export'); | ||
var getBuiltIn = require('../internals/get-built-in'); | ||
var bind = require('../internals/function-bind-context'); | ||
var uncurryThis = require('../internals/function-uncurry-this'); | ||
var IndexedObject = require('../internals/indexed-object'); | ||
var toObject = require('../internals/to-object'); | ||
var lengthOfArrayLike = require('../internals/length-of-array-like'); | ||
var arrayMethodIsStrict = require('../internals/array-method-is-strict'); | ||
var addToUnscopables = require('../internals/add-to-unscopables'); | ||
|
||
var Map = getBuiltIn('Map'); | ||
var MapPrototype = Map.prototype; | ||
var mapGet = uncurryThis(MapPrototype.get); | ||
var mapHas = uncurryThis(MapPrototype.has); | ||
var mapSet = uncurryThis(MapPrototype.set); | ||
var push = uncurryThis([].push); | ||
var $groupToMap = require('../internals/array-group-to-map'); | ||
|
||
// `Array.prototype.groupByToMap` method | ||
// https://github.com/tc39/proposal-array-grouping | ||
// https://bugs.webkit.org/show_bug.cgi?id=236541 | ||
$({ target: 'Array', proto: true, forced: !arrayMethodIsStrict('groupByToMap') }, { | ||
groupByToMap: function groupByToMap(callbackfn /* , thisArg */) { | ||
var O = toObject(this); | ||
var self = IndexedObject(O); | ||
var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); | ||
var map = new Map(); | ||
var length = lengthOfArrayLike(self); | ||
var index = 0; | ||
var key, value; | ||
for (;length > index; index++) { | ||
value = self[index]; | ||
key = boundFunction(value, index, O); | ||
if (mapHas(map, key)) push(mapGet(map, key), value); | ||
else mapSet(map, key, [value]); | ||
} return map; | ||
} | ||
$({ target: 'Array', proto: true, name: 'groupToMap', forced: !arrayMethodIsStrict('groupByToMap') }, { | ||
groupByToMap: $groupToMap | ||
}); | ||
|
||
addToUnscopables('groupByToMap'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var $ = require('../internals/export'); | ||
var addToUnscopables = require('../internals/add-to-unscopables'); | ||
var $groupToMap = require('../internals/array-group-to-map'); | ||
|
||
// `Array.prototype.groupToMap` method | ||
// https://github.com/tc39/proposal-array-grouping | ||
$({ target: 'Array', proto: true }, { | ||
groupToMap: $groupToMap | ||
}); | ||
|
||
addToUnscopables('groupToMap'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
var $ = require('../internals/export'); | ||
var $group = require('../internals/array-group'); | ||
var addToUnscopables = require('../internals/add-to-unscopables'); | ||
|
||
// `Array.prototype.group` method | ||
// https://github.com/tc39/proposal-array-grouping | ||
$({ target: 'Array', proto: true }, { | ||
group: function group(callbackfn /* , thisArg */) { | ||
var thisArg = arguments.length > 1 ? arguments[1] : undefined; | ||
return $group(this, callbackfn, thisArg); | ||
} | ||
}); | ||
|
||
addToUnscopables('group'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// https://github.com/tc39/proposal-array-grouping | ||
require('../modules/esnext.array.group'); | ||
require('../modules/esnext.array.group-to-map'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// https://github.com/tc39/proposal-array-grouping | ||
// TODO: Remove from `core-js@4` | ||
require('../modules/esnext.array.group-by'); | ||
require('../modules/esnext.array.group-by-to-map'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
require('../proposals/array-find-from-last'); | ||
require('../proposals/array-grouping-stage-3'); | ||
require('../proposals/array-grouping-stage-3-2'); | ||
require('../proposals/change-array-by-copy'); | ||
// TODO: Obsolete versions, remove from `core-js@4` | ||
require('../proposals/array-grouping-stage-3'); | ||
var parent = require('./4'); | ||
|
||
module.exports = parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.