2.0.0 • Published 1 year ago

slice-all v2.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
1 year ago

If I should maintain this repo, please ⭐️

DM me on Twitter if you have questions or suggestions.


Installation

yarn add slice-all
npm install slice-all
pnpm add slice-all

Usage

Slice at multiple locations:

import sliceAll from "slice-all";

sliceAll("20200101T123456", [4, 6, 8, 9, 11, 13]);

// => ["2020", "01", "01", "T", "12", "34", "56"]

Use negatives when index from left is unknown:

import sliceAll from "slice-all";

sliceAll("12-------------34", [2, -2]);

// => ["12", "-------------", "34"]

To specify segment lengths instead of indicies, use negatives:

import sliceAll from "slice-all";

sliceAll("20200101T123456", [-8, -1, -2, -2, -2])

// => ["20200101", "T", "12", "34", "56"]
  • autorepo: Autorepo abstracts away your dev dependencies, providing a single command to run all of your scripts.

MIT