2.5.66 • Published 1 year ago

@zitterorg/qui-doloremque v2.5.66

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

@zitterorg/qui-doloremque Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES spec-compliant Array.prototype.slice 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.slice depends on a receiver (the “this” value), the main export takes the array to operate on as the first argument.

Engines where this is needed

Note: this list is not exhaustive.

  • Safari 10 - 13
  • Chrome 48+ (v8 bug)
  • node 6+

Example

var slice = require('@zitterorg/qui-doloremque');
var assert = require('assert');

var a = [1, 2, 3];
assert.deepEqual(slice(a, 1, 2), [2]);
assert.deepEqual(slice(a, -2), [2, 3]);
var slice = require('@zitterorg/qui-doloremque');
var assert = require('assert');
/* when Array#slice is not present */
delete Array.prototype.slice;
var shimmed = slice.shim();
assert.equal(shimmed, slice.getPolyfill());
assert.equal(shimmed, Array.prototype.slice);
assert.deepEqual([1, 2, 3].slice(1, 2), slice([1, 2, 3], 1, 2));
var slice = require('@zitterorg/qui-doloremque');
var assert = require('assert');
/* when Array#slice is present */
var shimmed = slice.shim();
assert.equal(shimmed, Array.prototype.slice);
assert.deepEqual([1, 2, 3].slice(1, 2), slice([1, 2, 3], 1, 2));

Tests

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

2.5.66

1 year ago

2.5.65

1 year ago

2.5.62

1 year ago

2.5.63

1 year ago

2.5.64

1 year ago

2.4.61

1 year ago

2.4.60

1 year ago

2.4.62

1 year ago

2.4.58

1 year ago

2.4.57

1 year ago

2.4.59

1 year ago

2.4.54

1 year ago

2.4.53

1 year ago

2.4.56

1 year ago

2.4.55

1 year ago

2.4.49

1 year ago

2.4.48

1 year ago

1.3.31

1 year ago

1.3.32

1 year ago

1.3.30

1 year ago

1.4.46

1 year ago

1.3.35

1 year ago

1.4.45

1 year ago

1.3.36

1 year ago

1.4.48

1 year ago

1.3.33

1 year ago

1.4.47

1 year ago

1.3.34

1 year ago

2.4.50

1 year ago

1.3.39

1 year ago

1.2.27

1 year ago

1.2.28

1 year ago

2.4.52

1 year ago

1.3.37

1 year ago

2.4.51

1 year ago

1.3.38

1 year ago

1.2.26

1 year ago

1.1.19

1 year ago

1.2.29

1 year ago

1.1.18

1 year ago

1.3.42

1 year ago

1.2.30

1 year ago

1.3.43

1 year ago

1.3.40

1 year ago

1.3.41

1 year ago

1.1.23

1 year ago

1.1.22

1 year ago

1.3.44

1 year ago

1.1.21

1 year ago

1.3.45

1 year ago

1.1.20

1 year ago

1.1.26

1 year ago

1.1.25

1 year ago

1.1.24

1 year ago

1.1.17

1 year ago

1.1.16

1 year ago

1.0.15

1 year ago

1.1.15

1 year ago

1.0.14

1 year ago

1.0.11

1 year ago

1.0.13

1 year ago

1.0.12

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

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago