Skip to content

Helix - v0.0.5

Compare
Choose a tag to compare
@ItsJonQ ItsJonQ released this 03 Nov 18:55
· 102 commits to master since this release

Add compose function, and HelixSpec.extend

This update adds a new compose function, that allows you to combine
Specs together (as well as regular objects) into a new HelixSpec.

This is powered by the new HelixSpec.extend method, which uses Object.assign
to extend the spec "shape".

The new composed Spec is generated with the usual .generate method.

Example

const PersonSpec = new HelixSpec({
  id: faker.random.number()
})
const MessageSpec = new HelixSpec({
  read: faker.random.boolean(),
  timestamp: faker.date.past(),
  message: faker.lorem.paragraph()
})

const ComposedSpec = compose(PersonSpec, MessageSpec)
const fixture = ComposedSpec.generate()

Resolves: #3