Slice2.js
Slice2.js is a extensions of repo slice.js, Slice2.js allows to use slice operator like python.
Install
npm install slice2
Slice.js
const slice = // for arrayconst arr = ; arr-2; // 9arr'2:5'; // [3, '4', 5]arr':-2'; // [1, '2', 3, '4', 5, '6', 7, '8']arr'-2:'; // [9, '0']arr'1:5:2'; // ['2', '4']arr'5:1:-2'; // ['6', '4'] // for stringconst str = ; str-2; // '9'str'2:5'; // '345'str':-2'; // '12345678'str'-2:'; // '90'str'1:5:2'; // '24'str'5:1:-2'; // '64'
Slice2.js
const slice = const arr = ;var value = 3 arr'::-1' // ['0', 9, '8', 7, '6', 5, '4', 3, '2', 1]arr':-2'; // [1, '2', 3, '4', 5, '6', 7, '8']arr':-2''2::' // [3, '4', 5, '6', 7, '8']arr`::` // ['4', 5, '6', 7, '8', 9, '0'] const tab = 123 245 // all subs array become sliceablevar sliceArr = sliceArr'1::' // [ [ 2, 4, 5 ] ] for let s of sliceArr console // out:// [ 2, 3 ]// [ 4, 5 ]
Authors
- Antonio Musolino - antoniomuso
License
This project is licensed under the MIT License - see the LICENSE file for details