power-set-x

2.1.2 • Public • Published

Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score Coverage Status

power-set-x

Calculates the Power Set of a set S.

module.exports(value)Array.<Array>

This method calculates the Power Set of value. Array sparseness is ignored.

In mathematics, the power set (or powerset) of any set S, written P(S), ℘(S), P(S), ℙ(S) or 2S, is the set of all subsets of S, including the empty set and S itself.

Kind: Exported function
Returns: Array.<Array> - The power set of value.
See: http://en.wikipedia.org/wiki/Power_set

Param Type Description
value Array The array like value to get the power set of.

Example

import powerSet from 'power-set-x';

console.log(powerSet([1, 2, 3])); // [[], [3], [2], [2, 3], [1], [1, 3], [1, 2], [1, 2, 3]]

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.1.2
    2
    • latest

Version History

Package Sidebar

Install

npm i power-set-x

Weekly Downloads

4

Version

2.1.2

License

MIT

Unpacked Size

327 kB

Total Files

11

Last publish

Collaborators

  • xotic750