Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
@immutable-array/splice
Advanced tools
Readme
Immutable Array.prototype.splice()
.
Install with npm:
npm install @immutable-array/splice
Same API with Array.prototype.splice()
.
/**
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
* @param array Base array.
* @param start The zero-based location in the array from which to start removing elements.
* @param deleteCount The number of elements to remove.
* @param items Elements to insert into the array in place of the deleted elements.
*/
export declare function splice<T>(array: Array<T>, start?: number, deleteCount?: number, ...items: T[]): Array<T>;
Delete all:
import { splice } from "@immutable-array/splice"
const originalArray = ["a", "b", "c", "d", "e"];
const resultArray = splice(originalArray, 0);
assert.deepStrictEqual(resultArray, []);
Delete range: 1-3
import { splice } from "@immutable-array/splice"
const originalArray = ["a", "b", "c", "d", "e"];
const resultArray = splice(originalArray, 1, 3);
assert.deepStrictEqual(resultArray, ["a", "e"]);
Delete and Insert = replace index 0 with "x"
import { splice } from "@immutable-array/splice"
const originalArray = ["a", "b", "c", "d", "e"];
const resultArray = splice(originalArray, 0, 1, "x");
assert.deepStrictEqual(resultArray, ["x", "b", "c", "d", "e"]);
See Releases page.
Install devDependencies and Run npm test
:
npm i -d && npm test
Pull requests and stars are always welcome.
For bugs and feature requests, please create an issue.
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
MIT © azu
FAQs
Immutable Array.prototype.splice
The npm package @immutable-array/splice receives a total of 117 weekly downloads. As such, @immutable-array/splice popularity was classified as not popular.
We found that @immutable-array/splice demonstrated a not healthy version release cadence and project activity because the last version was released 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
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.