1.1.0 • Published 2 years ago

itertool-js v1.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

ITERTOOL-JS

Installation:

npm i itertool-js

Usage:

const iter = require('itertool-js')

About:

This npm package is created to bring some awesome functionalites from Python's Itertools library. This package has the functionalities like combinations, combinations_withreplacement, permutations from "Python's Itertools" Library.

Functions

combinations(value)

combinations_custom(value, range) => Array [ combinations with range ]

combinations("ABCD") or combinations(['a','b','c','d']) => [ possible unique combinations ]

The value may be a string or 1 Dimensional array, this function returns an array of possible unique combinations.

combinations_withreplacement(value)

combinations_custom_withreplacement(value, range)

combinations_withreplacement("ABCD") or combinations_withreplacement(['a','b','c','d']) => [ all possible combinations ]

The value may be a string or 1 Dimensional array, this function returns an array of possible all combinations.

permutations(value)

permutations("ABCD") => [ all possible permutations ]

permutations_custom(string or array, range) => [all possible permutations with desired range]

The value must be a string , this function returns an array of possible all permutations of a given string.

Oher Minor Functions

accumulate(array) => return array
chain(string) => return array
compress(['a','b','c','d','e','f'], [1, 0, 1, 1, 0, 0]) => ['a', 'c', 'd']
count(start, step, end) => array
cycle(string,end) => array
from_iterables(iterable(contains all strings [may be multidimentional])) => return array( of single elements)
product(string) => return array of all possible pairs
repeat(item, n) => return array of items for n times
1.1.0

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago