Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
array.prototype.keys
Advanced tools
An ES2015 spec-compliant `Array.prototype.keys` shim/polyfill/replacement that works as far down as ES3.
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.
var keys = require('array.prototype.keys');
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('array.prototype.keys');
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('array.prototype.keys');
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]);
Simply clone the repo, npm install
, and run npm test
v1.1.3 - 2024-03-19
8c934c4
c1707be
es-object-atoms
and is-callable
instead of es-abstract
f31da3d
call-bind
, define-properties
, es-abstract
, es-create-array-iterator
, es-shim-unscopables
7613579
aud
, function-bind
, npmignore
, tape
18300be
call-bind
, es-create-array-iterator
0dc2391
tape
61f2501
FAQs
An ES2015 spec-compliant `Array.prototype.keys` shim/polyfill/replacement that works as far down as ES3.
The npm package array.prototype.keys receives a total of 352 weekly downloads. As such, array.prototype.keys popularity was classified as not popular.
We found that array.prototype.keys demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.