Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xotic750/power-set-x

Calculates the Power Set of a set S. http://en.wikipedia.org/wiki/Power_set
https://github.com/xotic750/power-set-x

browser ecmascript nodejs powerset

Last synced: 4 days ago
JSON representation

Calculates the Power Set of a set S. http://en.wikipedia.org/wiki/Power_set

Awesome Lists containing this project

README

        


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**

```js
import powerSet from 'power-set-x';

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