Skip to content

kemitchell/possible-objects.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

var possible = require('possible-objects')

The package exports a single function. That function takes a single argument: An Object schema whose property values are all Arrays of possible object property values.

The function returns an Array of all the Objects whose properties have values permitted by the schema.

var assert = require('assert')
assert.deepEqual(
  possible({
      a: [1, 2],
      b: [3, 4] }),
  [ { a: 1, b: 3 },
    { a: 1, b: 4 },
    { a: 2, b: 3 },
    { a: 2, b: 4 } ])

About

given a simple Object schema, return all possible Objects

Resources

Stars

Watchers

Forks

Packages

No packages published