Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
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 0 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
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.