2.8.111 • Published 11 months ago

@diotoborg/rem-officia v2.8.111

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@diotoborg/rem-officia 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('@diotoborg/rem-officia');
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('@diotoborg/rem-officia');
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('@diotoborg/rem-officia');
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

ES6sortedsetimportexporttrimRighteslintconfigi18narktypebddgetterBigUint64ArrayWebSocketObject.entriesfigletglobjasminehas-owncall-boundserializationlookextradom-testing-libraryES3Microsofttextrssfind-upidquerystringiaminvariantsetterelasticachetypesafeYAMLregular-expressionarraysreact-testing-librarycheckfastclonewidthhardlinksemojidependenciesprivate dataparseeast-asian-widthenvclassnames[[Prototype]]channelSymbolappbundlerES8requiretypedarrayisConcatSpreadablechailruec2CSSbabel-corevareslintinstallermodulesJSONbinES2019jsxconfigurablegetintrinsicnameUint8ArrayzerogenericsawesomesauceperformanceECMAScript 2021vestprunereactcloudtrailes2018resolveinstrumentationObservablesArray.prototype.includesRxJSroutercoercibleuuidPushtranspileReflect.getPrototypeOfcomputed-typesWeakMapargvArray.prototype.flatMapArray.prototype.containsCSSStyleDeclarationbabelintrinsicjshinttranspilerObject.fromEntriestoolkitglobalThisspawnwaithelpervaluergbswfUint16ArrayInt16Arraynumberoptimizerbrowserslistfull-widthebsdebugbyteOffsethashglobal this valuesyntaxcontainsmobilepromisedeep-clonefindruntimeletmetadatatsliberrorassertionfixed-widthtyped arraymonoreposyntaxerrordescriptionMapwaapicloudsearcharraybufferECMAScript 5listenersschema0chromepackagesObjectqsstyleguideredactconstmakepipepoint-freestarterworkflowUint32ArraysetImmediatedefineidentifiersReactiveExtensionsbrowserlisttestingcall256real-timetransformpositiveomitfsargsfaststableformattingfeeddateinputspringcloudfrontworkspace:*npmECMAScript 2017readablestreamcommand-linereadupaccessibilityamazonscheme-validationes7fast-deep-clonenegative zeroelbAsyncIteratoranimationregular expressionpnpm9speces2017snsjoicurriedoncetypedarraysurldotenvbrowsertc39asteriskswarningtoReversedxhrpropertydataviewlook-upstreams-0Object.getPrototypeOfviewautoprefixerpureclonesymlinksboundeventDispatchergesturestostringtagstringifierdropStyleSheetwgetformatuser-streamsistanbulregularstructuredCloneyupchildselfreducertypedchineseArrayBuffer#sliceserializeremitassertArrayBufferfast-cloneweakmap
2.8.111

11 months ago

2.7.111

11 months ago

2.7.110

11 months ago

2.7.109

11 months ago

2.7.108

11 months ago

2.6.108

11 months ago

2.6.107

11 months ago

2.6.106

11 months ago

2.6.105

11 months ago

2.6.104

11 months ago

2.6.103

11 months ago

2.6.102

11 months ago

2.6.101

11 months ago

2.6.100

11 months ago

2.6.99

11 months ago

2.6.98

11 months ago

2.6.97

11 months ago

2.6.96

11 months ago

2.6.95

11 months ago

2.5.95

12 months ago

2.5.94

12 months ago

2.5.93

12 months ago

2.5.92

12 months ago

2.5.91

12 months ago

2.5.90

12 months ago

2.5.89

12 months ago

2.5.88

12 months ago

2.5.87

12 months ago

2.5.86

12 months ago

2.5.85

12 months ago

2.5.84

12 months ago

2.4.84

12 months ago

2.4.83

12 months ago

2.4.82

12 months ago

2.4.81

12 months ago

2.4.80

12 months ago

2.4.79

12 months ago

2.3.79

12 months ago

2.3.78

12 months ago

2.3.77

1 year ago

2.3.76

1 year ago

2.3.75

1 year ago

2.3.74

1 year ago

2.3.73

1 year ago

2.3.72

1 year ago

2.3.71

1 year ago

2.3.70

1 year ago

2.3.69

1 year ago

2.3.68

1 year ago

2.2.68

1 year ago

2.2.67

1 year ago

2.2.66

1 year ago

2.2.65

1 year ago

2.2.64

1 year ago

2.2.63

1 year ago

2.2.62

1 year ago

2.2.61

1 year ago

2.2.60

1 year ago

2.2.59

1 year ago

2.2.58

1 year ago

2.2.57

1 year ago

2.2.56

1 year ago

2.2.55

1 year ago

2.2.54

1 year ago

2.2.53

1 year ago

2.2.52

1 year ago

2.2.51

1 year ago

2.2.50

1 year ago

2.2.49

1 year ago

2.2.48

1 year ago

2.2.47

1 year ago

2.2.46

1 year ago

2.2.45

1 year ago

2.2.44

1 year ago

2.2.43

1 year ago

2.2.42

1 year ago

2.2.41

1 year ago

2.2.40

1 year ago

2.2.39

1 year ago

2.2.38

1 year ago

2.2.37

1 year ago

2.2.36

1 year ago

2.2.35

1 year ago

2.2.34

1 year ago

2.2.33

1 year ago

2.2.32

1 year ago

2.2.31

1 year ago

2.1.31

1 year ago

2.1.30

1 year ago

2.1.29

1 year ago

2.1.28

1 year ago

2.1.27

1 year ago

2.1.26

1 year ago

2.1.25

1 year ago

2.1.24

1 year ago

2.1.23

1 year ago

2.1.22

1 year ago

2.0.22

1 year ago

2.0.21

1 year ago

2.0.20

1 year ago

2.0.19

1 year ago

2.0.18

1 year ago

2.0.17

1 year ago

2.0.16

1 year ago

2.0.15

1 year ago

2.0.14

1 year ago

2.0.13

1 year ago

2.0.12

1 year ago

2.0.11

1 year ago

2.0.10

1 year ago

2.0.9

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago