Skip to content

A small library for inverse slice and splice methods/functions for strings and arrays in node.js

License

Notifications You must be signed in to change notification settings

joakim5937x/inverse-slice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

inverse-slice

A small library for inverse slice and splice methods/functions for strings and arrays in node.js

Install

npm: inverse-slice

npm install inverse-slice

Example

Inverse slice (iSlice)

require('inverse-slice');

let arr1 = [1,2,3,4,5,6,7];

let start = 0;
let end = 1;
let arr2 = arr1.iSlice(start, end); // Inverse slice from start to end, will not modify arr1
console.log(arr2);
// -> [2,3,4,5,6,7]
console.log(arr1)
// -> [1,2,3,4,5,6,7] not modified

Api

Just use:

require('inverse-slice');

Slice

Will work with arrays and strings:

Array.iSlice(start, end);
String.iSlice(start, end);

About

A small library for inverse slice and splice methods/functions for strings and arrays in node.js

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published