@erboladaiorg/suscipit-consectetur-perspiciatis

1.3.34 • Public • Published

@erboladaiorg/suscipit-consectetur-perspiciatis Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

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

Example

var keys = require('@erboladaiorg/suscipit-consectetur-perspiciatis');
var assert = require('assert');
var iterate = require('iterate-iterator');

assert.deepEqual(iterate(keys([1, 2, 3])), [0, 1, 2]);
assert.deepEqual(iterate(keys([1, 0, 1])), [0, 1, 2]);
assert.deepEqual(iterate(keys([NaN])), [0]);
assert.deepEqual(iterate(keys([1,,3])), [0, 1, 2]);
var keys = require('@erboladaiorg/suscipit-consectetur-perspiciatis');
var assert = require('assert');
/* when Array#keys is not present */
delete Array.prototype.keys;
var shimmedMap = keys.shim();
assert.deepEqual(shimmedMap, keys.getPolyfill());
assert.deepEqual(iterate([1, 2, 3].keys()), [0, 1, 2]);
assert.deepEqual(iterate([1, 0, 1].keys()), [0, 1, 2]);
assert.deepEqual(iterate([NaN].keys()), [0]);
assert.deepEqual(iterate([1,,3].keys()), [0, 1, 2]);
var keys = require('@erboladaiorg/suscipit-consectetur-perspiciatis');
var assert = require('assert');
/* when Array#keys is present */
var shimmedMap = keys.shim();
assert.equal(shimmedMap, Array.prototype.keys);
assert.deepEqual(iterate([1, 2, 3].keys()), [0, 1, 2]);

Tests

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

Readme

Keywords

Package Sidebar

Install

npm i @erboladaiorg/suscipit-consectetur-perspiciatis

Weekly Downloads

365

Version

1.3.34

License

MIT

Unpacked Size

52.7 kB

Total Files

97

Last publish

Collaborators

  • diepminhb311