Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 990 Bytes

File metadata and controls

39 lines (29 loc) · 990 Bytes

extend(...specs)

Extends the spec shape of the HelixSpec.

Arguments

Argument Type Description
specs object Merges the additional objects with the initial spec object.

Returns

HelixSpec: Return itself.

Example

To extend the initial spec shape, pass in a new object as an argument. Additional objects can be passed in as additional arguments.

const Dinosaur = createSpec({
  id: faker.datatype.number(),
  name: faker.name.firstName(),
  location: faker.address.country(),
});

Dinosaur.extend({
  company: "Jurassic Parkland",
  color: faker.commerce.color(),
});

// Dinosaur's spec shape will now be:
// {
//   id: faker.datatype.number(),
//   name: faker.name.firstName(),
//   location: faker.address.country(),
//   company: 'Jurassic Parkland',
//   color: faker.commerce.color()
// }