7.6.68 • Published 11 months ago

@hishprorg/nobis-atque v7.6.68

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

@hishprorg/nobis-atque Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ESnext spec-compliant Array.prototype.at 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 proposed spec.

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

Getting started

npm install --save @hishprorg/nobis-atque

Usage/Examples

var at = require('@hishprorg/nobis-atque');
var assert = require('assert');

var arr = [1, [2], [], 3];

var results = at(arr, function (x, i) {
	assert.equal(x, arr[i]);
	return x;
});

assert.deepEqual(results, [1, 2, 3]);
var at = require('@hishprorg/nobis-atque');
var assert = require('assert');
/* when Array#at is not present */
delete Array.prototype.at;
var shimmedFlatMap = at.shim();

var mapper = function (x) { return [x, 1]; };

assert.equal(shimmedFlatMap, at.getPolyfill());
assert.deepEqual(arr.at(mapper), at(arr, mapper));
var at = require('@hishprorg/nobis-atque');
var assert = require('assert');
/* when Array#at is present */
var shimmedIncludes = at.shim();

var mapper = function (x) { return [x, 1]; };

assert.equal(shimmedIncludes, Array.prototype.at);
assert.deepEqual(arr.at(mapper), at(arr, mapper));

Tests

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

7.6.68

11 months ago

7.6.67

11 months ago

7.6.66

11 months ago

7.6.65

11 months ago

7.6.64

11 months ago

7.6.63

12 months ago

7.6.62

12 months ago

7.6.61

12 months ago

7.6.60

12 months ago

7.6.59

12 months ago

7.6.58

12 months ago

7.6.57

12 months ago

7.6.56

12 months ago

7.6.55

12 months ago

7.6.54

12 months ago

7.6.53

12 months ago

7.6.52

12 months ago

7.6.51

12 months ago

7.6.50

12 months ago

7.5.50

12 months ago

7.5.49

12 months ago

7.4.49

12 months ago

7.4.48

12 months ago

7.4.47

12 months ago

6.4.47

12 months ago

6.4.46

1 year ago

6.4.45

1 year ago

6.4.44

1 year ago

6.4.43

1 year ago

6.4.42

1 year ago

6.4.41

1 year ago

6.4.40

1 year ago

5.4.40

1 year ago

5.4.39

1 year ago

5.3.39

1 year ago

5.3.38

1 year ago

5.3.37

1 year ago

5.3.36

1 year ago

5.3.35

1 year ago

5.3.34

1 year ago

5.3.33

1 year ago

5.3.32

1 year ago

5.3.31

1 year ago

5.3.30

1 year ago

5.3.29

1 year ago

4.3.29

1 year ago

4.2.29

1 year ago

4.2.28

1 year ago

4.2.27

1 year ago

4.1.27

1 year ago

4.1.26

1 year ago

4.1.25

1 year ago

4.0.25

1 year ago

4.0.24

1 year ago

4.0.23

1 year ago

4.0.22

1 year ago

4.0.21

1 year ago

4.0.20

1 year ago

3.0.20

1 year ago

3.0.19

1 year ago

3.0.18

1 year ago

3.0.17

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

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

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago