JSPM

inverse-slice

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9
  • Score
    100M100P100Q43211F
  • License MIT

Use just like slice/splice but it give inversed result

Package Exports

  • inverse-slice

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (inverse-slice) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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);