Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

array.prototype.tospliced

es-shims45.4kMIT1.1.5

An ESnext spec-compliant Array.prototype.toSpliced shim/polyfill/replacement that works as far down as ES3.

javascript, ecmascript, shim, polyfill, es-shim API, array, sort, sorted, toSpliced

readme

array.prototype.tospliced Version Badge

dependency status dev dependency status License Downloads

npm badge

An ESnext spec-compliant Array.prototype.toSpliced 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 proposed spec.

Because Array.prototype.toSpliced depends on a receiver (the this value), the main export takes the array to operate on as the first argument.

Getting started

npm install --save array.prototype.tospliced

Usage/Examples

var toSpliced = require('array.prototype.tospliced');
var assert = require('assert');

var input = [5, 4, 3, 2, 1, 0];

var output = toSpliced(input, 2, 2);

assert.notEqual(output, input);
assert.deepEqual(output, [5, 4, 1, 0]);
assert.deepEqual(input, [5, 4, 3, 2, 1, 0]);
var toSpliced = require('array.prototype.tospliced');
var assert = require('assert');
/* when Array#toSpliced is not present */
delete Array.prototype.toSpliced;
var shimmed = toSpliced.shim();

assert.equal(shimmed, toSpliced.getPolyfill());
assert.deepEqual(input.toSpliced(), toSpliced(input));
var toSpliced = require('array.prototype.tospliced');
var assert = require('assert');
/* when Array#toSpliced is present */
var shimmed = toSpliced.shim();

assert.equal(shimmed, Array.prototype.toSpliced);
assert.deepEqual(input.toSpliced(), toSpliced(input));

Tests

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

changelog

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.1.5 - 2024-12-17

Commits

  • [actions] split out node 10-20, and 20+ c6386f7
  • [Dev Deps] update @es-shims/api, @ljharb/eslint-config, auto-changelog, mock-property, tape 17d0270
  • [Refactor] use math-intrinsics directly 803b934
  • [Deps] update call-bind, es-abstract, get-intrinsic cae48a4
  • [Refactor] use call-bound directly d5cc382
  • [Tests] replace aud with npm audit a0fd3b3
  • [Dev Deps] add missing peer dep 7f944a9

v1.1.4 - 2024-03-20

Commits

  • [actions] use reusable workflows 1c4c03a
  • [Deps] update call-bind, es-abstract, es-errors, get-intrinsic 39027ed
  • [Dev Deps] update hasown, tape 2d1f421
  • [meta] add missing engines.node a4f30e3
  • [Refactor] use es-object-atoms where possible 60d77f1

v1.1.3 - 2024-02-04

Commits

  • [Deps] update call-bind, define-properties, es-abstract, es-shim-unscopables, get-intrinsic 092514b
  • [Dev Deps] use hasown instead of has 9bbb5ee
  • [Dev Deps] update aud, npmignore, tape 22a5165
  • [Dev Deps] update mock-property, tape 07401a6
  • [Refactor] use es-errors where possible, so things that only need those do not need get-intrinsic 566b616
  • [Deps] update get-intrinsic 5fdf845

v1.1.2 - 2023-08-28

Commits

  • [Deps] update define-properties, es-abstract, get-intrinsic 9bda002
  • [Dev Deps] update @es-shims/api, @ljharb/eslint-config, aud, tape 9c7622b

v1.1.1 - 2022-11-03

Commits

  • [Tests] add a passing test262 test 321a21a
  • [Deps] update es-abstract, get-intrinsic c91b852
  • [actions] update rebase action to use reusable workflow fb2ac61
  • [Dev Deps] update aud, tape 2732744

v1.1.0 - 2022-08-14

Commits

v1.0.0 - 2022-03-31

Commits

  • initial implementation, tests, readme dddd145
  • Initial commit d19956c
  • [meta] do not publish workflow files 2d9801b
  • [Tests] temporarily use actions instead of composable workflows c273f9e
  • [Fix] spec change: improve algorithm 34c5c02
  • npm init 4fe60d7
  • [Fix] spec change: throw a TypeError when the length is >= 2**53 47c07af
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, auto-changelog, tape 731f6be
  • [meta] add version script 926df38
  • Only apps should have lockfiles 2af504f
  • [Deps] update es-abstract 8c49ee5