Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

just-permutations

angus-c1.4kMIT2.2.1TypeScript support: included

Returns all permutations of the length N of the elements of the given Array

array, list, algorithm, permutations, just

readme

just-permutations

Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.

🍦 Try it

npm install just-permutations
yarn add just-permutations

Returns all permutations of the length N of the elements of the given Array

import permutations from 'just-array-permutations;

permutations([1, 2, 3]); // [[1, 2, 3], [2, 1, 3], [2, 3, 1], [1, 3, 2], [3, 1, 2], [3, 2, 1]]
permutations([]); // []
permutations(); // throws

changelog

just-permutations

2.2.1

Patch Changes

  • Support for element type array

2.2.0

Minor Changes

  • Rename node module .js -> .cjs

2.1.1

Patch Changes

  • fix: reorder exports to set default last #488

2.1.0

Minor Changes

  • package.json updates to fix #467 and #483