2.0.3 • Published 14 days ago

@teamteanpm2024/quae-tenetur-qui v2.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
14 days ago

@teamteanpm2024/quae-tenetur-qui Version Badge

github actions coverage License Downloads

npm badge

An ESnext spec-compliant Object.groupBy shim/polyfill/replacement that works as far down as ES3.

This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the proposed spec.

Getting started

npm install --save @teamteanpm2024/quae-tenetur-qui

Usage/Examples

var groupBy = require('@teamteanpm2024/quae-tenetur-qui');
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],
});
var groupBy = require('@teamteanpm2024/quae-tenetur-qui');
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));
var groupBy = require('@teamteanpm2024/quae-tenetur-qui');
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

jsdomwaapigraphqlwordbreakcharactercryptECMAScript 2018equalityinstallersearchio-tsnegativecode pointsstatelessloggingtoolswebArray.prototype.flatMapdebugreal-timetrimRightTypedArraymobileECMAScript 2021buffersMaputilquerystringratedebuggerprotourlArray.prototype.findLastIndexbddoptimistweaksetsigintes-shimsArrayBufferFloat64Arraycachees5extrasameValueZerovarsymlinksregexpfp.envFloat32ArrayclassnamescloneenumerablehelpersmonoreponoperamdagetintrinsicfunctionalECMAScript 2015taskimmutablefast-copyArray.prototype.includesglobstartenderqueueMicrotaskloggerexpressdefinePropertyphoneconcatMapexpressionexecmimetypescorerapidhookstoSortedlookECMAScript 2016schemebyteOffsethardlinksdeep-clonexhrconcurrencymodulesrequestvaluees-shim APIvalidationclassesparentsdragperformantredactextensioneslint-pluginregular expressionpropertiesrfc4122gettershelljson-schemastructuredCloneString.prototype.matchAllES2023statustoobjectkoreancss-in-jsconsumeURLSearchParamspromisestableartflattenreadableeverykeysObject.entriespopmotionsequencelrutimeInt8ArrayArray.prototype.containsscheme-validationbabelStyleSheetECMAScript 5eventEmitterhandlersjavascriptlogesES7polyfillECMAScript 6exitapilazyreducerchineseprocess-0genericswatcherauthenticationjsonschemaeventDispatcherreactdatecss variableappserializerbrowsercircularlanguagewrapreact animationArray.prototype.flattenPromisereadclass-validatorlistenersES6widthMicrosoftinvariantierm -rfRFC-6455fast-deep-copylinuxmake dir6to5streams2emojiqueryexecutableflagecmascriptinspectloadingdescriptionstringifyunicodefullratelimitAsyncIteratorlesscssECMAScript 2023eslintpluginperformancecss nestingjsxRegExp.prototype.flagspositiveUint8ArrayviewES3mergearraybuffertostringtag
2.0.3

14 days ago

2.0.2

15 days ago

2.0.1

16 days ago

2.0.0

17 days ago

1.0.0

17 days ago