0.0.1-security • Published 1 year ago

@dramaorg/dolorum-placeat-quidem v0.0.1-security

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

@dramaorg/dolorum-placeat-quidem 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('@dramaorg/dolorum-placeat-quidem');
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('@dramaorg/dolorum-placeat-quidem');
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('@dramaorg/dolorum-placeat-quidem');
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

0.0.1-security

1 year ago

5.9.86

1 year ago

5.9.87

1 year ago

5.9.88

1 year ago

3.2.26

1 year ago

5.9.89

1 year ago

3.2.28

1 year ago

3.2.27

1 year ago

5.9.85

1 year ago

3.2.29

1 year ago

5.4.61

1 year ago

5.4.62

1 year ago

5.4.60

1 year ago

3.2.31

1 year ago

3.2.30

1 year ago

3.2.32

1 year ago

4.3.48

1 year ago

4.3.47

1 year ago

5.6.73

1 year ago

5.6.72

1 year ago

5.4.51

1 year ago

5.6.75

1 year ago

5.6.74

1 year ago

5.6.71

1 year ago

5.6.70

1 year ago

5.4.58

1 year ago

5.4.59

1 year ago

5.4.56

1 year ago

5.4.57

1 year ago

5.6.77

1 year ago

5.4.54

1 year ago

5.6.76

1 year ago

5.4.55

1 year ago

5.4.52

1 year ago

5.6.78

1 year ago

5.4.53

1 year ago

5.8.85

1 year ago

5.6.64

1 year ago

5.8.82

1 year ago

5.8.83

1 year ago

5.8.84

1 year ago

5.6.69

1 year ago

5.6.66

1 year ago

5.6.65

1 year ago

5.6.68

1 year ago

5.6.67

1 year ago

4.2.42

1 year ago

4.2.43

1 year ago

4.2.44

1 year ago

4.2.45

1 year ago

4.2.40

1 year ago

4.2.41

1 year ago

4.2.46

1 year ago

4.2.47

1 year ago

5.3.50

1 year ago

4.2.32

1 year ago

4.2.33

1 year ago

2.2.26

1 year ago

4.2.34

1 year ago

2.2.24

1 year ago

2.2.25

1 year ago

4.2.39

1 year ago

4.2.35

1 year ago

4.2.36

1 year ago

4.2.37

1 year ago

5.3.51

1 year ago

4.2.38

1 year ago

5.5.62

1 year ago

5.5.63

1 year ago

1.2.18

1 year ago

1.2.19

1 year ago

5.7.81

1 year ago

5.7.80

1 year ago

5.7.82

1 year ago

1.2.20

1 year ago

5.3.49

1 year ago

5.3.48

1 year ago

1.2.23

1 year ago

1.2.24

1 year ago

1.2.21

1 year ago

1.2.22

1 year ago

5.5.64

1 year ago

5.7.78

1 year ago

5.7.79

1 year ago

1.2.17

1 year ago

1.1.17

1 year ago

1.0.16

1 year ago

1.1.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

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

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago