1.0.0 • Published 18 days ago

@zibuthe7j11/enim-odio-vitae v1.0.0

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

@zibuthe7j11/enim-odio-vitae Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES5 spec-compliant Array.prototype.reduce 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 spec.

Because Array.prototype.reduce depends on a receiver (the “this” value), the main export takes the array to operate on as the first argument.

Example

var reduce = require('@zibuthe7j11/enim-odio-vitae');
var assert = require('assert');

assert.equal(reduce([1, 2, 3], function (prev, x) { return prev + x; }), 6);
assert.equal(reduce([1, 2, 3], function (prev, x) { return prev + x; }, 1), 7);
var reduce = require('@zibuthe7j11/enim-odio-vitae');
var assert = require('assert');
/* when Array#reduce is not present */
delete Array.prototype.reduce;
var shimmed = reduce.shim();
assert.equal(shimmed, reduce.getPolyfill());
var arr = [1, 2, 3];
var sum = function (a, b) { return a + b; };
assert.equal(arr.reduce(sum), reduce(arr, sum));
assert.equal(arr.reduce(sum), 6);
assert.equal(arr.reduce(sum, 1), 7);
var reduce = require('@zibuthe7j11/enim-odio-vitae');
var assert = require('assert');
/* when Array#reduce is present */
var shimmed = reduce.shim();
assert.equal(shimmed, Array.prototype.reduce);
assert.equal(arr.reduce(sum), reduce(arr, sum));

Tests

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

deterministicstarterrm -rfstyles[[Prototype]]letoffsetaccessibilitypopmotionECMAScript 2022macostypedshrinkwrapJSON-Schemalesscsslanguagequerystringreadablestreamhassharedregular expressionmakepicomatchstableargumentconcatMapeslint-pluginjsonvisualstyled-componentsfilterthreefast-deep-clonecollection.es6nameserroremojiio-tswidthmovefetchrecursiveless.jsspeedtypedarraysidtestanimationpatchtoobjectcensorBigUint64ArrayESnextTypeBoxflagprotoairbnblastsyntaxerrorboundjson-schema-validatorjsdiffdeepcopyjasminedeepcloneCSSStyleDeclarationECMAScript 7eventDispatchermkdirsECMAScript 3qsECMAScript 2021extensionupString.prototype.matchAllcommand-lineproptacitglobhttpsexitasserttc39watchfulltoolkittypesasynces-abstractprogresslogcryptoObject.valueslook-upsyntaxxdg-openfolderstylermslotdeep-clonejson-schemareact posesanitizelockfiletsReflect.getPrototypeOfreusemiddlewareString.prototype.trimansimime-dbsuperagentfixed-widthwhichperformantfast-clonemochavalidationHyBiobjectfindsymbolspinnerjwtassigntranspilecss variableextendwordbreakdebugArray.prototype.containsstreams2ES8flatFunction.prototype.nameloggingmkdirpcompile lessfseveryfromnameWeakMapefficient6to5keysObject.keysfull-widthwindowsfastifygraphqlieObject.getPrototypeOfmatchAllbuffersuuidArray.prototype.flatMapprivatestatusenderzerokoreangetintrinsicStreamsurlsxsswalkingarraybufferstylingopenerinternal slotsetPrototypeOfbabeltypeerrorstreamnopeoperating-systemdragpoint-freeweaksetvestvariableshookformclassnamescallboundfastcopypolyfillapiratelimitguidthrottlesymbolsweakmapjavascriptECMAScript 2018linewrapcompilerES2023optimistshamnpmtraverse3dastpostcss-pluginlaunches2016ECMAScript 6chromiumStyleSheetxdgmonoreposanitizationes-shim APIinternalestreebundlerlessrobustgetPrototypeOfFloat64ArrayresolveenvironmentspringequalityrapidutilsfunctionsgetOwnPropertyDescriptordeeppasswordtrimRightmimeapollojsonschemacode pointsbindWebSocketES6iteratorqueuevarwatchingmkdirstructuredClonetranspilerautoprefixersameValueZeroharmonyenumerablegetterjson-schema-validationfast-copyredactfileeast-asian-widthconstArray.prototype.flattenReactiveXrmdirTypeScriptsequenceflagsdrop0multi-packagedayjshasOwntimetapepackageprunetapjoiruntime256utilityreactinferencetakeelectronurlbufferoptiondescriptorslengthstreams.envES3byteLengthrgbtaskestextfigletspecvaluepushtypeofcryptRFC-6455ES5containsdatacompareeslintconfigqueueMicrotaskes2015curriedmoduleArray.prototype.includesreadabledeletefastclonelintreact-hook-formhigher-ordertelephoneuser-streamsbreak
1.0.0

18 days ago