1.0.0 • Published 12 days ago

@crabas0npm/fuga-pariatur-illo v1.0.0

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

@crabas0npm/fuga-pariatur-illo 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 @crabas0npm/fuga-pariatur-illo

Usage/Examples

var groupBy = require('@crabas0npm/fuga-pariatur-illo');
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('@crabas0npm/fuga-pariatur-illo');
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('@crabas0npm/fuga-pariatur-illo');
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

argsjson-schemareducerIteratorless compilerPushsymlinksiteratemacosbyteOffsetwaitreact posegroupinterruptspropertyrequirepathhttpsterminalgetoptcall-bindincludesclientvalidateObject.entriesencryption$.extendinternal-0classnamerobustsymboldeepcopyjQueryUint32ArrayavasetPrototypeOfqueuestarterupthroattrimexecutablelengthcheckURLflatMapwritedotenvcomputed-typesfinduplaunchinputerrorPromisermasthttpbuffersharedarraybufferbcryptReactiveExtensionsflagsstatelessdataViewtypescriptfunctionalwatcheresmonorepofunctionconfigobjslicefetchentriestostringtagbatchsideECMAScript 2019regular expression0react-hook-formarraysguidloggerregularutilitiescolorsextraStreamsstreams2deterministicbyteLengthjapaneserapidthree256queueMicrotaskwindowsreduxjoiObservablesless.jsprefixRxlesscsscallbrowserargumentsmatchschememruredactformWebSocketES2018matchAlloptimistes2016websitedebugcmdsafeloggingdatadataviewArrayBuffercommandES2015visualReflect.getPrototypeOffastifylanguagecompilerhashdayjstoStringTagimmutablereact-hooksinternal slotauthenticationbyteUint8ClampedArrayargparseposemulti-packagetypeInt8Arrayutiles5equalserializationphonetaskreuseramdacontainshooksvalidationFloat64ArrayforEachTypedArraycollection.es6ES2020bundlerTypeScriptweaksetes8limitedcss lessjsdompicomatches6call-boundspinnernegative zerojestmixinscorschromettyjson-schema-validatorwatchinghardlinksprivate datatestwordbreakprettyfoldereventsrangeerror3ddefaultStreamWebSocketsbundlingparentsECMAScript 2017assertsdirreact-testing-libraryframerredux-toolkitESnextjsframeworkArray.prototype.findLastIndexcolores-shimsECMAScript 3emitserializegetOwnPropertyDescriptorsymlinkmkdirindicatorxhrrateprogresssuperagentformscsspolyfilllistenersfunctionsdebugger_.extendcryptparserdeep-cloneeveryWeakSetcoreArraybabel-coresameValueZerolintJSON-Schemaremovepuregradients css3lockfileeditorpasswordponyfillfromclipyyamltoolkitassertionpreserve-symlinksstatusoperating-systemgesturesECMAScript 2023file systemconnectajaxresolvecjktypeerrornpmrm -rfqueryinstallerwarningreactarraybufferUint8ArrayArray.prototype.flattenprotobufrandomjson-schema-validationasciiECMAScript 2016ES2017nopekoreanpatchquerystringtermzeroreadsortedbrowserlistapolloarktypeStyleSheetcopyES5eslint-plugincharacterfsutilitynegativeeventEmitterirqbootstrap csses2018argumentdefinePropertyloadingpostcss-plugines7ES8propertiesschematakees2017expressurlreducefast-cloneURLSearchParamscallboundlazyArray.prototype.containsweakmapimmerECMAScript 2022expressiontoolsArray.prototype.flatMaparttelephonespawnRegExp#flagsinferenceMapstringifierdescriptionformatwatchdatetypesafeplugindomfast-deep-copygetterstringcss nestinglinewrap.envoutputmkdirppopmotionecmascriptArray.prototype.filtergraphqlprunekeysObject.keystranspileasyncjsonpathlessshamreal-timefixed-widthworkspace:*karmarm -frfastlibphonenumberestreerequeststructuredClonestableUnderscoreES2022ArrayBuffer.prototype.slicesigtermspeedtyped arraymochadescriptorsanitizedefinebabelreact animationruntimestylesheeteslintpluginreadablestreampackage.jsonimporthigher-ordersanitizationHyBiletclass-validatorharmonyeslintconfigsearchArray.prototype.findLastfind-upECMAScript 6setsettingslimitpackagetoArraywhichgroupByES3concatunicodeanimationString.prototype.trimformattingFloat32Arraybrowserslistgradients cssbddoncestreamsdependency managergettypeofvariables in cssECMAScript 7ECMAScript 2018Object.definePropertyeventDispatcherutil.inspectvalidatorinspectObservablenativemetadataArray.prototype.includesperformancelookconsumeio-tsfindLasttypedmapshellmimeconsolea11yconcatMaperror-handlingregexvardroptranspilerless css
1.0.0

12 days ago