simple-combinatorics

1.0.2 • Public • Published

simple-combinatorics

simple-combinatorics is a JavaScript library that has functionality for simple data management calculations.

Installation

Use the package manager npm to install simple-combinatorics.

npm install simple-combinatorics

Usage

let data = require('simple-combinatorics');

let arr = data.range(1,10); //[1,2,3,4,5,6,7,8,9,10]
let k = 5; //OPTIONAL: Number of spots in permutation/combination
let noRepeat = true; //OPTIONAL: Controls if repeats are valid

//returns 2d array of all permutations
let permutationList = data.permuteList(arr,k,noRepeat);

//returns number of valid permutations
let permutationNumber = data.permute(arr.length, k, noRepeat);

//returns 2d array of all combinations
let combinationList = data.chooseList(arr,k,noRepeat);

//returns number of valid combinations
let combinationNumber = data.choose(arr.length, k, noRepeat);

Contributing

This library is mainly for my own personal use, but if you find it useful and would like to contribute, you are welcome to.

License

MIT

Package Sidebar

Install

npm i simple-combinatorics

Weekly Downloads

18

Version

1.0.2

License

MIT

Unpacked Size

3.78 kB

Total Files

3

Last publish

Collaborators

  • ryan.bush