New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

heaps-algorithm

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

heaps-algorithm

Heap's algorithm for generating permutations of an array.

latest
npmnpm
Version
1.0.0
Version published
Weekly downloads
2
100%
Maintainers
1
Weekly downloads
 
Created
Source

heaps-algorithm

Heap's algorithm for generating permutations of an array.

installation

npm install heaps-algorithm

usage

This module exports a function, which returns an array of all permutations of the array passed to it.

var permutations = require('heaps-algorithm'),
    actual = permutations([1, 2, 3]),
    expected = [
      [ 1, 2, 3 ],
      [ 2, 1, 3 ],
      [ 3, 1, 2 ],
      [ 1, 3, 2 ],
      [ 2, 3, 1 ],
      [ 3, 2, 1 ]
    ];

assert.deepEqual(actual, expected); // true

Keywords

Heap's Algorithm

FAQs

Package last updated on 15 May 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts