spicejs

0.0.1 • Public • Published

Build Status Coverage Status

Spice

Python style slices in JavaScript.

Code Example

Basic usage

var spice = require('spicejs');

spice('123456789', '2:6'); // '3456'
spice('123456789', '6:2'); // ''
spice('123456789', ':'); // '123456789'

Extended syntax

var spice = require('spicejs');

spice([1, 2, 3, 4, 5, 6, 7, 8, 9], '::3'); // [1, 4, 7]

Extending native objects

var spice = require('spicejs');

if (!Array.prototype.spice) {
	Array.prototype.spice = function(slice) {
		return spice(this, slice);
	}
}

[1, 2, 4, 5, 6].spice('2:5') // [3, 4, 5]

Installation

npm install spice

License

MIT. Copyright (c) Larry Wu

/spicejs/

    Package Sidebar

    Install

    npm i spicejs

    Weekly Downloads

    1

    Version

    0.0.1

    License

    MIT

    Last publish

    Collaborators

    • lw7360