1.0.2 • Published 2 years ago

combinations-algo v1.0.2

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

Combinations Algo

This is a repository for the package combinations-algo;

This package uses a generator to get combinations over a function so you can get the next combination when needed instead of blocking your code awaiting a huge array of possible combinations.

❔ How to use

Make sure you install the package:

 $ npm i combinations-algo

Then simply:

import { getCombinations } from "combinations-algo";

const input = [1,2];
const firstCombination = getCombinations(input).next();
console.log(firstCombination); // [1]

🗺 Planned features

  • Getting combinations largest to smallest
  • Normal function for getting all combinations (for the times you do need them all at once)
  • Jumping to a certain index (the N-th combination)
  • Jumping to a certain size

If you want any other features, feel free to post them here!