0.1.6 • Published 2 years ago

permutationsjs v0.1.6

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

Description

Generate all possible permutations of given elements.

Install

npm i permutationsjs

Usage

import permutations from 'permutationsjs'

const _permutations = []

permutations(
    [0,1], // the elements to permutate
    6, // the size of permutations
    false, // whether to avoid repetition of elements in the permutations
    permutation => _permutations.push(permutation) // a callback on each permutation
)

Algorithm

At each step of the recursion, pick one element and map all other elements to it.

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago