UNPKG

fcircuit-core

Version:

Core library for functional circuit modeling and simulation.

14 lines (13 loc) 358 B
export const generateCombinations = (length) => { const result = [] const generate = (current, depth) => { if (depth === length) { result.push(current) return } generate([...current, 0], depth + 1) generate([...current, 1], depth + 1) } generate([], 0) return result }