1.0.0 • Published 1 year ago

@ptkhanh94npm/ullam-harum-similique v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@ptkhanh94npm/ullam-harum-similique Version Badge

github actions coverage License Downloads

npm badge

An ESnext spec-compliant Map.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 @ptkhanh94npm/ullam-harum-similique

Usage/Examples

var groupBy = require('@ptkhanh94npm/ullam-harum-similique');
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, new Map([
    ['even', [0, 2, 4]],
    ['odd', [1, 3, 5]],
]));
var groupBy = require('@ptkhanh94npm/ullam-harum-similique');
var assert = require('assert');
/* when Map.groupBy is not present */
delete Map.groupBy;
var shimmed = groupBy.shim();

assert.equal(shimmed, groupBy.getPolyfill());
assert.deepEqual(Map.groupBy(arr, parity), groupBy(arr, parity));
var groupBy = require('@ptkhanh94npm/ullam-harum-similique');
var assert = require('assert');
/* when Array#group is present */
var shimmed = groupBy.shim();

assert.equal(shimmed, Map.groupBy);
assert.deepEqual(Map.groupBy(arr, parity), groupBy(arr, parity));

Tests

Simply clone the repo, npm install, and run npm test

trimRightupprotobufsuperstructchairatelimitStreamsestreeutil.inspectcryptomatchAllcloudformationscheme-validationwordbreakguidindicatores2017rmdirwatchersearchArrayBuffer#slicees-shim APIgdprweaksetlintroute53efficienttypecheckreducedescriptorglobstringifyless mixinsPushcloudsearchunicodeIteratorES2019inferencesorts3writehigher-orderreactlook-upwidthimmerString.prototype.trimSymbol.toStringTagmetadataURLownjwtpipecoerciblemomentObject.assignbuffersoptimizerhas-ownObjectimporthashstyleguidetapecopybootstrap lesses7dom-testing-libraryjsdiffarraysrecursiveserializestdliboncecolor[[Prototype]]execfast-copycallbackformattingtestingi18nwritablevaluesfileArray.prototype.filterpnpm9tapjsonpathmiddlewareES2017eslintconfigtoobjectES6io-tsstableassertioncommand-linethreeeslintpluginreact animationES2022regular expressioncloudtraileslintflatautoscalingquerystringECMAScript 2017loadbalancingwebStreamhttpstypedarraysavavaluewgetWebSocketsspecthroatclonestarteres-shimsparseArray.prototype.flates5variables in csscss variablefastifycsssyntaxlastkinesismatchesobjoutputpostcss-plugintslibtoSortedregular expressionslockfileObservablewaapigetterinvariantMapdropgraphqlprefixsnsprivate datadependenciesgetArray.prototype.includeselbrdsdeletepackage.jsonArrayBuffer.prototype.slicejoirangeerror256streams2weakmapconsumedataviewwafseswarningdefineoperating-systemprettyECMAScript 2015make dirqueueMicrotasklinktypesafeprotocol-buffersinternal slotparentkeysInt16ArrayMicrosoftsafeeventDispatcherreadablestreamargumentES5ECMAScript 2020debuggercode pointslesscsspersistentpreserve-symlinksloggeraccessibilityBigInt64Arraycommandercomputed-typesObject.definePropertylimitArrayBufferenvgetPrototypeOflimitedtostringtagstringifieramazonerror-handlingpluginreadablejavascript.envwatchFileCSSrm -rfelectronrobusthttpdataViewvisualfpshasOwnshimidleomitenumerablefullemrUint32ArrayidemojisigintforEach
1.0.0

1 year ago