
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
array.prototype.values
Advanced tools
An ES2015 spec-compliant `Array.prototype.values` shim/polyfill/replacement that works as far down as ES3.
An ES2015 spec-compliant Array.prototype.values
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.values
depends on a receiver (the “this” value), the main export takes the array to operate on as the first argument.
var values = require('array.prototype.values');
var assert = require('assert');
var iterate = require('iterate-iterator');
assert.deepStrictEqual(iterate(values([1, 2, 3])), [1, 2, 3]);
assert.deepStrictEqual(iterate(values([1, 0, 1])), [1, 0, 1]);
assert.deepStrictEqual(iterate(values([NaN])), [NaN]);
assert.deepStrictEqual(iterate(values([1,,3])), [1, undefined, 3]);
var values = require('array.prototype.values');
var assert = require('assert');
/* when Array#values is not present */
delete Array.prototype.values;
var shimmedMap = values.shim();
assert.deepStrictEqual(shimmedMap, values.getPolyfill());
assert.deepStrictEqual(iterate([1, 2, 3].values()), [1, 2, 3]);
assert.deepStrictEqual(iterate([1, 0, 1].values()), [1, 0, 1]);
assert.deepStrictEqual(iterate([NaN].values()), [NaN]);
assert.deepStrictEqual(iterate([1,,3].values()), [1, undefined, 3]);
var values = require('array.prototype.values');
var assert = require('assert');
/* when Array#values is present */
var shimmedMap = values.shim();
assert.equal(shimmedMap, Array.prototype.values);
assert.deepStrictEqual(iterate([1, 2, 3].values()), [1, 2, 3]);
Simply clone the repo, npm install
, and run npm test
v1.0.1 - 2020-11-17
2b621a9
3708449
7c3eb4e
eslint
, @ljharb/eslint-config
, aud
, auto-changelog
, tape
efc1360
es-abstract
; use call-bind
where applicable 4d16a43
nyc
on all tests e7423a5
5d1329f
auto-changelog
, tape
0b40bd7
@ljharb/eslint-config
572f6c4
aud
, auto-changelog
82ab9c3
357ca4d
pull_request_target
event 61160a7
es-abstract
ffbdcab
FAQs
An ES2015 spec-compliant `Array.prototype.values` shim/polyfill/replacement that works as far down as ES3.
The npm package array.prototype.values receives a total of 182 weekly downloads. As such, array.prototype.values popularity was classified as not popular.
We found that array.prototype.values 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
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.