Skip to content
Javascript Permutation
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
tests
.gitignore
LICENSE
README.md
index.js
package.json

README.md

Generates all possible values based on a defined length.. with or without a limit

const permutater = require('permutater');
permutater({
    characters : 'abcdefghijklmnopqrstuvwxyz0123456789'.split(''),
    length : 3
})
// ['aaa', 'aab', 'aac' ... '997', '998', '999'].length = 46656
permutater({
    charactersAt : {
        0 : ['0', '1', '2']
    },
    characters : 'abcdefghijklmnopqrstuvwxyz'.split(''),
    length : 2
})
// ['0a', '0b', '0c' ... '2x', '2y', '2z'].length = 78
permutater({
    charactersAt : {
        0 : ['a', 'b'],
        1 : ['-']
    },
    characters : 'abcdefghijklmnopqrstuvwxyz'.split(''),
    length : 3
})
// ['a-a', 'a-b', 'a-c' ... 'b-x', 'b-y', 'b-z'].length = 52
permutater({
    characters : 'abcdefghijklmnopqrstuvwxyz0123456789'.split(''),
    length : 5,
    limit : 30
})
// ['fn6p3', 'x83na', '3v20r' ... ].length = 30
permutater({
    characters : 'abcdefghijklmnopqrstuvwxyz0123456789'.split(''),
    length : 8,
})
// out of memory
You can’t perform that action at this time.