1.0.0 • Published 24 days ago

@zibuthe7j11/delectus-quos-saepe v1.0.0

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

@zibuthe7j11/delectus-quos-saepe 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/delectus-quos-saepe');
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/delectus-quos-saepe');
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/delectus-quos-saepe');
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

ES3sanitizewindowstypedarraycompilerfunctionsECMAScript 5typeredux-toolkitassigninterruptstrimReactiveXArray.prototype.containsserializekeyformspoint-freeArrayBuffer.prototype.slicelimitedresolvecommandfind-upreadconcatrm -frfastcloneES2019css variablecallbindes5configurablees7ES7getOwnPropertyDescriptorpropertyuppersistentbabelrecursiveintrinsiccode pointsArrayBuffercensorduplexmixinsxtermasyncquerynested cssflatMapbootstrap lesspackage managerstdlibtoobjectECMAScript 2015installerauthenticationfixed-widthajvarraybatchtestform-validationarktypemulti-packageInt32ArrayefficientUint8ArraybreakuuidTypedArrayforEachyamlfoldersortdiffESopenRegExp#flagsstringifyreadablejsdiffreduxRegExp.prototype.flagsfast-deep-copycore-jswidthpromisesmapfindupserializationautoprefixerphonepackageiteratorexittoSortedlintformvarclassnamesdeep-copyunicodeparserlimitjasminenodejsshamless csspnpm9dom-testing-librarymochamkdirutilio-tswaitYAMLUnderscoredirectoryoffsetl10nbrowserlistzeroargparsevalidpopmotionworkspace:*numbertakematchAlltrimRighttypesInt8ArraygroupBylookexpresswhatwgECMAScript 2019nameslesscsscolourfseventsoperating-systemcomputed-typesmiddlewareUint16ArraycallboundnpmremoveAsyncIteratorfantasy-landgesturesECMAScript 6file systemextendObject.entriesES8Int16Arraynegative zerotrimEnduninstallenvironmentwalkpurecompile lessinputeslintconfigthroaterrorcachecolorObject.isfindLastIndexECMAScript 2021ECMAScript 2018performantprivate dataapollopasswordzoderror-handlingdeepecmascripttypesafestylingdeletequotechrometerminalinferencepicomatchregularstructuredClonespecECMAScript 2016posebuffersutilityES2016ttywalkingArraydotenvtypedarrayssuperstructpreprocessordescriptorsfunctionUint32Arrayavalastlazystyled-componentssharedarraybufferloadingentrieswordwrapmake dirlibphonenumberoptimizerTypeScriptserializerrapiddeepcopyshimformatURLSearchParamsqsReflect.getPrototypeOfstreamWebSockettypeerrorexectoArrayassertionprotocol-bufferspipeconsolepreserve-symlinksdebugArray.prototype.flatstatusdescriptionjwtequaljsonpathletbufferJSON-Schemalook-upprivatetermStyleSheetstreams2a11yobjectIteratorFloat64Array.envES2020east-asian-widthnodepluginnegativehooksconnectmonorepologgerclientchromiumtypaniontoolsstringifiereslintvalueregular expressionthreegetintrinsicwatchemojiasciitoolkitprotowgeteslintpluginObjectindicatorhttpsbrowserslistinvariantgdprimmutablesymbolminimalframeworktostringtagsortedflagjsonschemafullwidthcss-in-jsesString.prototype.trimfast-cloneutil.inspectparseflagstesteranimationreact-hook-formcss nestingsidemovebabel-corecoerciblehttptranspilePushcreatecopymatchesmkdirpObservablejoiargvbyteLengthhelperswritefast-deep-cloneArray.prototype.flatMapreact-testing-librarytraversebyteOffsetcompareArray.prototype.findLastUint8ClampedArrayES2015class-validatorrobustES5assertshookformvalidationestreequerystringjson-schemaECMAScript 2017somemobilespeediterationBigInt64ArrayiteratetouchsignalsbundlerurlRxidlestablerangeerrorfindObject.assignbusyclassnameincludesdeepclonecommanderfunctionalcollection.es6rm -rfeventEmitterdomArray.prototype.filtergraphqlsliceprogressdragapitranspilersigtermemitreal-timeshebanginspectdeep-cloneomitdropeventDispatchereverycall-boundpropless.jses2017taskdependency managerdategradients cssslotlockfilees-shim APIFunction.prototype.namecss lessoncedataViewcallgetPrototypeOfreducergradients css3figletaccessorproperties[[Prototype]]framerpush0i18nJSONTypeBoxpostcss-pluginvalueses2016react-hookstestingisConcatSpreadableglobjsxbddcjkshrinkwrapassertschemeasthash@@toStringTagES2022mrutoStringTagMicrosoftcollectionboundtelephoneawesomesauceCSSStyleDeclarationvestqueuevisualmetadataclihardlinksless compilercryptBigUint64Arraychairgbeventsreducefastcopywhichfull-widthsameValueZerobluebirdbannerkoreanlinkcurriedjQueryvalidatorPromisecolumnsECMAScript 2023browsersequencesignalmoduleString.prototype.matchAllprunemimetypescharactersObject.keysstylesbindECMAScript 2020mime-db3dawaitmodulescloneequalityartmatchruntimegetoptvariableshigher-orderfastifyhasOwncolumnrfc4122circularcoredircallbackmakerequireoutputperformanceweakmapwatchingrequestclassesfastconcurrencymacostsESnextdependenciesHyBiwatchFilescheme-validationnativejson-schema-validatorArray.prototype.flattenchecktrimLeftes-abstractrandomsetterpositivees6jestfrominstalldatastructureWebSocketslinewrapwaapiajaxobjmergecryptostarteroptimistprototypebyteexit-codeRxJSwebenumerablesymlinkssearchwarningparentkeysECMAScript 3flatdatamimespinnertslib$.extendlinuxSymboljsonbootstrap cssratelimitless mixins256ES2018superagentbcryptprotobufelectronsyntaxlruarrayscorssharedramdajapanesesanitizationES6fptrimStartcharacterdescriptorreact poseratespinnersauthes8argskarmasetPrototypeOf
1.0.0

24 days ago