Detalhes do pacote

array.prototype.concat

es-shims11.8kMIT1.0.6

ES spec-compliant Array.prototype.concat shim/polyfill/replacement that works as far down as ES3.

javascript, ecmascript, polyfill, shim

readme (leia-me)

array.prototype.concat Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

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

Engines where this is needed

Note: this list is not exhaustive.

  • Safari 10 - 13
  • Chrome 48+ (v8 bug)
  • node 6+

Example

var concat = require('array.prototype.concat');
var assert = require('assert');

var a = [1, 1, 1];
assert.deepEqual(concat(a, 1, 2), [1, 1, 1, 1, 2]);
assert.deepEqual(a, [1, 1, 1]);
var concat = require('array.prototype.concat');
var assert = require('assert');
/* when Array#concat is not present */
delete Array.prototype.concat;
var shimmed = concat.shim();
assert.equal(shimmed, concat.getPolyfill());
assert.equal(shimmed, Array.prototype.concat);
assert.deepEqual([1, 2, 3].concat(1, 2, 3), concat([1, 2, 3], 1, 2, 3));
var concat = require('array.prototype.concat');
var assert = require('assert');
/* when Array#concat is present */
var shimmed = concat.shim();
assert.equal(shimmed, Array.prototype.concat);
assert.deepEqual([1, 2, 3].concat(1, 2, 3), concat([1, 2, 3], 1, 2, 3));

Tests

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

changelog (log de mudanças)

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

v1.0.6 - 2024-03-19

Commits

  • [actions] remove redundant finisher a36c200
  • [Deps] update call-bind, es-abstract 96556c4
  • [Refactor] use es-object-atoms, es-constants where possible e4732d3
  • [Dev Deps] update tape 851e12f

v1.0.5 - 2024-02-04

Commits

  • [Deps] update call-bind, define-properties, es-abstract, get-intrinsic 451da2d
  • [Refactor] use es-errors where possible, so things that only need those do not need get-intrinsic baea608
  • [Deps] update aud, npmignore, tape d99f9e4

v1.0.4 - 2023-09-05

Commits

  • [Deps] update define-properties, es-abstract, get-intrinsic 7b48041
  • [Dev Deps] update @es-shims/api, @ljharb/eslint-config, aud, tape f02ab9b
  • [actions] fix permissions 2223add

v1.0.3 - 2022-11-02

Commits

  • [meta] use npmignore to autogenerate an npmignore file 18587c7
  • [Deps] update es-abstract, get-intrinsic 1b6c0ff
  • [actions] update rebase action to use reusable workflow ef0963c
  • [Dev Deps] update aud, tape 3a1bd46
  • [readme] link to v8 bug f62d746

v1.0.2 - 2022-05-04

Commits

  • [Tests] FF 3 apparently does not support sparse arrays via syntax 2344e8e
  • [Fix] set .prototype of the implementation to undefined 7f55fb0
  • [Deps] update define-properties 5629a63
  • [Dev Deps] update functions-have-names c1fb579

v1.0.1 - 2022-05-03

Commits

  • [Fix] node 10.8+ and Chrome 68+ also need patching b39d8fb

v1.0.0 - 2022-05-03

Commits