1.0.0 • Published 5 years ago

@bannon/powerset v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

Powerset

A JavaScript implementation of calculating the powerset of a given array

Installation

$ npm install @bannon/powerset

Usage

This function can be called in multiple ways:

As an array

powerset(['a', 'b', 'c'])

As a string of characters

powerset('abc')

As function arguments

powerset('a', 'b', 'c')

These will all return the same result:

/*
[
  [],
  ["a"],
  ["b"],
  ["c"],
  ["a", "b"],
  ["b", "c"],
  ["a", "c"],
  ["a", "b", "c"]
]
*/