Bump the npm group with 2 updates (#1819)

* Bump the npm group with 2 updates

Bumps the npm group with 2 updates: [eslint](https://github.com/eslint/eslint) and [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import).


Updates `eslint` from 8.45.0 to 8.46.0
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.45.0...v8.46.0)

Updates `eslint-plugin-import` from 2.27.5 to 2.28.0
- [Release notes](https://github.com/import-js/eslint-plugin-import/releases)
- [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md)
- [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.27.5...v2.28.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: eslint-plugin-import
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update checked-in dependencies

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2023-08-01 03:35:02 -07:00 committed by GitHub
parent a6b0ced86b
commit e7e35baaf0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1408 changed files with 27215 additions and 9910 deletions

49
node_modules/object.groupby/.eslintrc generated vendored Normal file
View file

@ -0,0 +1,49 @@
{
"root": true,
"extends": "@ljharb",
"rules": {
"array-bracket-newline": "off",
"id-length": "off",
"max-lines-per-function": "off",
"new-cap": ["error", {
"capIsNewExceptions": [
"AddValueToKeyedGroup",
"Call",
"CreateDataPropertyOrThrow",
"GetIntrinsic",
"GetIterator",
"GetMethod",
"GroupBy",
"IsCallable",
"IteratorClose",
"IteratorComplete",
"IteratorNext",
"IteratorStep",
"IteratorValue",
"OrdinaryObjectCreate",
"RequireObjectCoercible",
"ThrowCompletion",
"ToPropertyKey",
"ToString",
"Type",
],
}],
},
"overrides": [
{
"files": "aos/*.js",
"rules": {
"max-statements": "off",
},
},
{
"files": "test/tests.js",
"rules": {
"max-lines-per-function": "off",
},
},
],
}

12
node_modules/object.groupby/.github/FUNDING.yml generated vendored Normal file
View file

@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/object.groupby
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

9
node_modules/object.groupby/.nycrc generated vendored Normal file
View file

@ -0,0 +1,9 @@
{
"all": true,
"check-coverage": false,
"reporter": ["text-summary", "text", "html", "json"],
"exclude": [
"coverage",
"test"
]
}

17
node_modules/object.groupby/CHANGELOG.md generated vendored Normal file
View file

@ -0,0 +1,17 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## v1.0.0 - 2023-07-11
### Commits
- Initial implementation, tests, readme [`77809f3`](https://github.com/es-shims/Object.groupBy/commit/77809f3024955519d71a2ab6ed9883e4d496a953)
- Initial commit [`24ea8cd`](https://github.com/es-shims/Object.groupBy/commit/24ea8cdc625987930d5cf9df0dbff01e5693a544)
- npm init [`36a7d4d`](https://github.com/es-shims/Object.groupBy/commit/36a7d4d9d2fc9ff8503985f2fcf76a2ff4097140)
- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `tape` [`bd7b39f`](https://github.com/es-shims/Object.groupBy/commit/bd7b39fca3d5fbff1e7140ae69893ec4694e4201)
- [Deps] update `define-properties`, `es-abstract`, `get-intrinsic` [`9615141`](https://github.com/es-shims/Object.groupBy/commit/9615141fab908eec83e310d8fdf6847a808baf36)
- Only apps should have lockfiles [`63b79a9`](https://github.com/es-shims/Object.groupBy/commit/63b79a97732802eb25da26928646e6ef103762cd)

21
node_modules/object.groupby/LICENSE generated vendored Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 ECMAScript Shims
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

79
node_modules/object.groupby/README.md generated vendored Normal file
View file

@ -0,0 +1,79 @@
# object.groupby <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-url]
An ESnext spec-compliant `Object.groupBy` shim/polyfill/replacement that works as far down as ES3.
This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the proposed [spec](https://tc39.github.io/proposal-array-grouping/).
## Getting started
```sh
npm install --save object.groupby
```
## Usage/Examples
```js
var groupBy = require('object.groupby');
var assert = require('assert');
var arr = [0, 1, 2, 3, 4, 5];
var parity = function (x) { return x % 2 === 0 ? 'even' : 'odd'; };
var results = groupBy(arr, function (x, i) {
assert.equal(x, arr[i]);
return parity(x);
});
assert.deepEqual(results, {
__proto__: null,
even: [0, 2, 4],
odd: [1, 3, 5],
});
```
```js
var groupBy = require('object.groupby');
var assert = require('assert');
/* when Object.groupBy is not present */
delete Object.groupBy;
var shimmed = groupBy.shim();
assert.equal(shimmed, groupBy.getPolyfill());
assert.deepEqual(Object.groupBy(arr, parity), groupBy(arr, parity));
```
```js
var groupBy = require('object.groupby');
var assert = require('assert');
/* when Array#group is present */
var shimmed = groupBy.shim();
assert.equal(shimmed, Object.groupBy);
assert.deepEqual(Object.groupBy(arr, parity), groupBy(arr, parity));
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.org/package/object.groupby
[npm-version-svg]: https://versionbadg.es/es-shims/Object.groupBy.svg
[deps-svg]: https://david-dm.org/es-shims/Object.groupBy.svg
[deps-url]: https://david-dm.org/es-shims/Object.groupBy
[dev-deps-svg]: https://david-dm.org/es-shims/Object.groupBy/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/Object.groupBy#info=devDependencies
[npm-badge-png]: https://nodei.co/npm/object.groupby.png?downloads=true&stars=true
[license-image]: https://img.shields.io/npm/l/object.groupby.svg
[license-url]: LICENSE
[downloads-image]: https://img.shields.io/npm/dm/object.groupby.svg
[downloads-url]: https://npm-stat.com/charts.html?package=object.groupby
[codecov-image]: https://codecov.io/gh/es-shims/Object.groupBy/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/es-shims/Object.groupBy/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Object.groupBy
[actions-url]: https://github.com/es-shims/Object.groupBy/actions

View file

@ -0,0 +1,26 @@
'use strict';
var callBound = require('call-bind/callBound');
var GetIntrinsic = require('get-intrinsic');
var SameValue = require('es-abstract/2022/SameValue');
var $TypeError = GetIntrinsic('%TypeError%');
var $filter = callBound('Array.prototype.filter');
var $push = callBound('Array.prototype.push');
module.exports = function AddValueToKeyedGroup(groups, key, value) {
var found = $filter(groups, function (group) {
return SameValue(group['[[Key]]'], key); // eslint-disable-line new-cap
});
if (found.length > 0) {
var g = found[0];
if (found.length !== 1) {
throw new $TypeError('Assertion failed: more than 1 Record inside `groups` has a `[[Key]]` that is SameValue to `key`');
}
$push(g['[[Elements]]'], value); // step 1.a.ii
} else {
var group = { '[[Key]]': key, '[[Elements]]': [value] }; // eslint-disable-line sort-keys
$push(groups, group); // step 3
}
};

81
node_modules/object.groupby/aos/GroupBy.js generated vendored Normal file
View file

@ -0,0 +1,81 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var AddValueToKeyedGroup = require('./AddValueToKeyedGroup');
var Call = require('es-abstract/2022/Call');
var GetIterator = require('es-abstract/2022/GetIterator');
var IsCallable = require('es-abstract/2022/IsCallable');
var IteratorClose = require('./IteratorClose');
var IteratorStep = require('./IteratorStep');
var IteratorValue = require('es-abstract/2022/IteratorValue');
var maxSafeInteger = require('es-abstract/helpers/maxSafeInteger');
var RequireObjectCoercible = require('es-abstract/2022/RequireObjectCoercible');
var ThrowCompletion = require('es-abstract/2022/ThrowCompletion');
var ToPropertyKey = require('es-abstract/2022/ToPropertyKey');
var $TypeError = GetIntrinsic('%TypeError%');
module.exports = function GroupBy(items, callbackfn, coercion) {
if (coercion !== 'property' && coercion !== 'zero') {
throw new $TypeError('Assertion failed: `coercion` must be `"property"` or `"zero"`');
}
RequireObjectCoercible(items); // step 1
if (!IsCallable(callbackfn)) { // step 2
throw new $TypeError('`callbackfn` must be callable');
}
var groups = []; // step 3
var iterator = GetIterator(items); // step 4
var iteratorRecord = { // TODO: remove this once GetIterator is on ES2023+
'[[Iterator]]': iterator,
'[[NextMethod]]': iterator.next,
'[[Done]]': false // eslint-disable-line sort-keys
};
var k = 0; // step 5
// eslint-disable-next-line no-constant-condition
while (true) { // step 6
if (k >= maxSafeInteger) { // step 6.a
var error = ThrowCompletion(new $TypeError('Iteration count exceeds the max safe integer value')); // step 6.a.i
return IteratorClose(iteratorRecord, error); // step 6.a.ii
}
var next = IteratorStep(iteratorRecord); // step 6.b
if (!next) { // step 6.c
return groups; // step 6.c.i
}
var value = IteratorValue(next); // step 6.d
var key;
try {
key = Call(callbackfn, undefined, [value, k]); // step 6.e
} catch (e) {
IteratorClose(iteratorRecord, ThrowCompletion(e)); // step 6.f
}
if (coercion === 'property') { // step 6.g
try {
key = ToPropertyKey(key); // step 6.g.i
} catch (e) {
IteratorClose(iteratorRecord, ThrowCompletion(e)); // step 6.g.ii
}
} else {
if (coercion !== 'zero') {
throw new $TypeError('Assertion failed: `coercion` should be `"zero"` here'); // step 6.h.i
}
if (key === 0) { // step 6.h.ii
key = 0; // handle negative zero
}
}
AddValueToKeyedGroup(groups, key, value); // step 6.i
k += 1; // step 6.j
}
};

67
node_modules/object.groupby/aos/IteratorClose.js generated vendored Normal file
View file

@ -0,0 +1,67 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var Call = require('es-abstract/2022/Call');
var CompletionRecord = require('es-abstract/2022/CompletionRecord');
var GetMethod = require('es-abstract/2022/GetMethod');
var Type = require('es-abstract/2022/Type');
var assertRecord = require('es-abstract/helpers/assertRecord');
// https://262.ecma-international.org/14.0/#sec-iteratorclose
module.exports = function IteratorClose(iteratorRecord, completion) {
assertRecord(Type, 'Iterator Record', 'iteratorRecord', iteratorRecord);
if (Type(iteratorRecord['[[Iterator]]']) !== 'Object') {
throw new $TypeError('Assertion failed: iteratorRecord.[[Iterator]] must be an Object'); // step 1
}
if (!(completion instanceof CompletionRecord)) { // step 2
throw new $TypeError('Assertion failed: completion is not a Completion Record instance');
}
var completionThunk = function () {
var value = completion.value();
if (completion.type() === 'throw') {
throw value;
}
return value;
};
var iterator = iteratorRecord['[[Iterator]]']; // step 3
var iteratorReturn;
try {
iteratorReturn = GetMethod(iterator, 'return'); // step 4
} catch (e) {
completionThunk(); // throws if `completion` is a throw completion // step 6
completionThunk = null; // ensure it's not called twice.
throw e; // step 7
}
if (typeof iteratorReturn === 'undefined') {
return completionThunk(); // step 5.a - 5.b
}
var innerResult;
try {
innerResult = Call(iteratorReturn, iterator, []);
} catch (e) {
// if we hit here, then "e" is the innerResult completion that needs re-throwing
completionThunk(); // throws if `completion` is a throw completion // step 6
completionThunk = null; // ensure it's not called twice.
// if not, then return the innerResult completion
throw e; // step 7
}
var completionRecord = completionThunk(); // if innerResult worked, then throw if the completion does
completionThunk = null; // ensure it's not called twice.
if (Type(innerResult) !== 'Object') {
throw new $TypeError('iterator .return must return an object');
}
return completionRecord;
};

28
node_modules/object.groupby/aos/IteratorNext.js generated vendored Normal file
View file

@ -0,0 +1,28 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = GetIntrinsic('%TypeError%');
var Call = require('es-abstract/2022/Call');
var Type = require('es-abstract/2022/Type');
var assertRecord = require('es-abstract/helpers/assertRecord');
// https://262.ecma-international.org/14.0/#sec-iteratornext
module.exports = function IteratorNext(iteratorRecord) {
assertRecord(Type, 'Iterator Record', 'iteratorRecord', iteratorRecord);
var result;
if (arguments.length < 2) { // step 1
result = Call(iteratorRecord['[[NextMethod]]'], iteratorRecord['[[Iterator]]']); // step 1.a
} else { // step 2
result = Call(iteratorRecord['[[NextMethod]]'], iteratorRecord['[[Iterator]]'], [arguments[1]]); // step 2.a
}
if (Type(result) !== 'Object') {
throw new $TypeError('iterator next must return an object'); // step 3
}
return result; // step 4
};

18
node_modules/object.groupby/aos/IteratorStep.js generated vendored Normal file
View file

@ -0,0 +1,18 @@
'use strict';
var IteratorComplete = require('es-abstract/2022/IteratorComplete');
var IteratorNext = require('./IteratorNext');
var Type = require('es-abstract/2022/Type');
var assertRecord = require('es-abstract/helpers/assertRecord');
// https://262.ecma-international.org/14.0/#sec-iteratorstep
module.exports = function IteratorStep(iteratorRecord) {
assertRecord(Type, 'Iterator Record', 'iteratorRecord', iteratorRecord);
var result = IteratorNext(iteratorRecord); // step 1
var done = IteratorComplete(result); // step 2
return done === true ? false : result; // steps 3-4
};

3
node_modules/object.groupby/auto.js generated vendored Normal file
View file

@ -0,0 +1,3 @@
'use strict';
require('./shim')();

20
node_modules/object.groupby/implementation.js generated vendored Normal file
View file

@ -0,0 +1,20 @@
'use strict';
var CreateDataPropertyOrThrow = require('es-abstract/2022/CreateDataPropertyOrThrow');
var OrdinaryObjectCreate = require('es-abstract/2022/OrdinaryObjectCreate');
var forEach = require('es-abstract/helpers/forEach');
var GroupBy = require('./aos/GroupBy'); // TODO: replace with es-abstract 2024 implementation
module.exports = function groupBy(items, callbackfn) {
var groups = GroupBy(items, callbackfn, 'property'); // step 1
var obj = OrdinaryObjectCreate(null); // step 2
forEach(groups, function (g) { // step 3
CreateDataPropertyOrThrow(obj, g['[[Key]]'], g['[[Elements]]']); // steps 3.a - 3.b
});
return obj; // step 4
};

19
node_modules/object.groupby/index.js generated vendored Normal file
View file

@ -0,0 +1,19 @@
'use strict';
var define = require('define-properties');
var callBind = require('call-bind');
var implementation = require('./implementation');
var getPolyfill = require('./polyfill');
var polyfill = getPolyfill();
var shim = require('./shim');
var bound = callBind(polyfill, Object);
define(bound, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});
module.exports = bound;

83
node_modules/object.groupby/package.json generated vendored Normal file
View file

@ -0,0 +1,83 @@
{
"name": "object.groupby",
"version": "1.0.0",
"description": "An ESnext spec-compliant `Object.groupBy` shim/polyfill/replacement that works as far down as ES3.",
"main": "index.js",
"exports": {
".": "./index.js",
"./auto": "./auto.js",
"./polyfill": "./polyfill.js",
"./implementation": "./implementation.js",
"./shim": "./shim.js",
"./package.json": "./package.json"
},
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"pretest": "npm run --silent lint",
"test": "npm run tests-only",
"posttest": "aud --production",
"tests-only": "nyc tape 'test/**/*.js'",
"lint": "eslint --ext=js,mjs .",
"postlint": "es-shim-api --bound && evalmd README.md",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/es-shims/Object.groupBy.git"
},
"keywords": [
"ecmascript",
"javascript",
"polyfill",
"shim",
"es-shim API",
"array",
"object",
"group",
"groupBy"
],
"author": "Jordan Harband <ljharb@gmail.com>",
"license": "MIT",
"bugs": {
"url": "https://github.com/es-shims/Object.groupBy/issues"
},
"homepage": "https://github.com/es-shims/Object.groupBy#readme",
"devDependencies": {
"@es-shims/api": "^2.4.2",
"@ljharb/eslint-config": "^21.1.0",
"aud": "^2.0.3",
"auto-changelog": "^2.4.0",
"es-value-fixtures": "^1.4.2",
"eslint": "=8.8.0",
"evalmd": "^0.0.19",
"for-each": "^0.3.3",
"functions-have-names": "^1.2.3",
"in-publish": "^2.0.1",
"npmignore": "^0.3.0",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.6.4"
},
"dependencies": {
"call-bind": "^1.0.2",
"define-properties": "^1.2.0",
"es-abstract": "^1.21.2",
"get-intrinsic": "^1.2.1"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"publishConfig": {
"ignore": [
".github/workflows"
]
}
}

7
node_modules/object.groupby/polyfill.js generated vendored Normal file
View file

@ -0,0 +1,7 @@
'use strict';
var implementation = require('./implementation');
module.exports = function getPolyfill() {
return Object.groupBy || implementation;
};

17
node_modules/object.groupby/shim.js generated vendored Normal file
View file

@ -0,0 +1,17 @@
'use strict';
var define = require('define-properties');
var getPolyfill = require('./polyfill');
module.exports = function shim() {
var polyfill = getPolyfill();
define(
Object,
{ groupBy: polyfill },
{ groupBy: function () { return Object.groupBy !== polyfill; } }
);
return polyfill;
};

13
node_modules/object.groupby/test/implementation.js generated vendored Normal file
View file

@ -0,0 +1,13 @@
'use strict';
var callBind = require('call-bind');
var test = require('tape');
var implementation = require('../implementation');
var runTests = require('./tests');
test('as a function', function (t) {
runTests(callBind(implementation, Object), t);
t.end();
});

12
node_modules/object.groupby/test/index.js generated vendored Normal file
View file

@ -0,0 +1,12 @@
'use strict';
var test = require('tape');
var index = require('../');
var runTests = require('./tests');
test('as a function', function (t) {
runTests(index, t);
t.end();
});

35
node_modules/object.groupby/test/shimmed.js generated vendored Normal file
View file

@ -0,0 +1,35 @@
'use strict';
require('../auto');
var test = require('tape');
var defineProperties = require('define-properties');
var callBind = require('call-bind');
var functionsHaveNames = require('functions-have-names')();
var isEnumerable = Object.prototype.propertyIsEnumerable;
var runTests = require('./tests');
var name = 'groupBy';
var fullName = 'Object.' + name;
test('shimmed', function (t) {
var fn = Object[name];
t.equal(fn.length, 2, fullName + ' has a length of 2');
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
st.equal(fn.name, name, fullName + ' has name "' + name + '"');
st.end();
});
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
et.equal(false, isEnumerable.call(Object, name), fullName + ' is not enumerable');
et.end();
});
runTests(callBind(fn, Object), t);
t.end();
});

62
node_modules/object.groupby/test/tests.js generated vendored Normal file
View file

@ -0,0 +1,62 @@
'use strict';
var inspect = require('object-inspect');
var forEach = require('for-each');
var v = require('es-value-fixtures');
module.exports = function (groupBy, t) {
t.test('callback function', function (st) {
forEach(v.nonFunctions, function (nonFunction) {
st['throws'](
function () { groupBy([], nonFunction); },
TypeError,
inspect(nonFunction) + ' is not a function'
);
});
st.end();
});
t.test('grouping', function (st) {
st.deepEqual(
groupBy([], function () { return 'a'; }),
{ __proto__: null },
'an empty array produces an empty object'
);
var arr = [0, -0, 1, 2, 3, 4, 5, NaN, Infinity, -Infinity];
var parity = function (x) {
if (x !== x) {
return void undefined;
}
if (!isFinite(x)) {
return '∞';
}
return x % 2 === 0 ? 'even' : 'odd';
};
var grouped = {
__proto__: null,
even: [0, -0, 2, 4],
odd: [1, 3, 5],
undefined: [NaN],
'∞': [Infinity, -Infinity]
};
st.deepEqual(
groupBy(arr, parity),
grouped,
inspect(arr) + ' group by parity groups to ' + inspect(grouped)
);
st.deepEqual(
groupBy(arr, function (x, i) {
st.equal(this, undefined, 'receiver is as expected'); // eslint-disable-line no-invalid-this
st.equal(x, arr[i], 'second argument ' + i + ' is ' + inspect(arr[i]));
return 42;
}),
{ __proto__: null, 42: arr },
'thisArg and callback arguments are as expected'
);
st.end();
});
};