pys
pys is a simple(
< 1 Kb
) javascript library to engance String.substring / Array.slice withpython slice style
.
In python, we can process string or array with code below:
string = '12345678'print (string[1:6:2])
Use this library, we can do similar things in javascript.
1. Install
npm install pys
2. Import It
Script
tag.
ES6
style.
var pys = ; //or ;
3. Usage & API
There is only one API named pys
. Below:
// for arrayvar arr = 1 '2' 3 '4' 5 '6' 7 '8' 9 '0'; '2:5'; // [3, '4', 5]':-2'; // [1, '2', 3, '4', 5, '6', 7, '8']'-2:'; // [9, '0']'1:5:2'; // ['2', '4']'5:1:-2'; // ['6', '4'] // for stringvar str = '1234567890';'2:5'; // '345'':-2'; // '12345678''-2:'; // '90''1:5:2'; // '24''5:1:-2'; // '64'
4. Test
npm install
npm test
4. LICENSE
MIT