How to use fast-cartesian - 1 common examples

To help you get started, we’ve selected a few fast-cartesian examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ehmicky / fast-cartesian / examples / iterate.js View on Github external
// This file can be directly run:
//   - first install `fast-cartesian`
//   - then `node node_modules/fast-cartesian/examples/iterate.js`
// An online demo is also available at:
//   https://repl.it/@ehmicky/fast-cartesian

'use strict'

// Ignore the following line: this is only needed for internal purposes.
require('./utils.js')

const { iterate } = require('fast-cartesian')

// Iterate over combinations
// eslint-disable-next-line fp/no-loops
for (const values of iterate([['red', 'blue'], ['circle', 'square']])) {
  console.log(values)
}
// [ 'red', 'circle' ]
// [ 'red', 'square' ]
// [ 'blue', 'circle' ]
// [ 'blue', 'square' ]

fast-cartesian

Fast cartesian product

Apache-2.0
Latest version published 1 year ago

Package Health Score

60 / 100
Full package analysis

Popular fast-cartesian functions