0.0.2 • Published 7 years ago

trend-arr-to-string v0.0.2

Weekly downloads
1
License
MIT
Repository
bitbucket
Last release
7 years ago

trend-arr-to-string v0.0.2

Async replacer array of numbers to string.

Install

npm i trend-arr-to-string

Test

npm test

Replace array to string

const Replacer = require('trend-arr-to-string');

const yourArr = [1, 2, 3, 4];
const string = await Replacer.replace(arr);

console.log(string); // 1,2,3,4

Arguments

NameTypeDescriptionDefault
arrayArrayArray of numbers.
stepLimitNumberLimit the numbers for one step.256

Replace array to ranges

const Replacer = require('trend-arr-to-string');

const yourArr = [1, 3, 4, 5, 6, 7, 8, 12, 13, 15];
const ranges = await Replacer.getRanges(arr);

console.log(ranges); // [[1], [3, 8], [12, 13], [15]]

Replace array to string ranges

const Replacer = require('trend-arr-to-string');

const yourArr = [1, 3, 4, 5, 6, 7, 8, 12, 13, 15];
const ranges = await Replacer.getStringRanges(arr);

console.log(ranges); // 1,3-8,12-13,15
0.0.2

7 years ago

0.0.1

7 years ago