Skip to content

NucleoObject

Matheus Marsiglio edited this page Aug 28, 2018 · 1 revision

NucleoObject is the primary object for Nucleo Objects. It guarantees we're dealing with the same Objects patterns and it allows to reuse better your data models (contracts).

Every object in contract is created using NucleoObject and can't have two of them with the same name, as the example below:

const completeNameType = new NucleoObject({
  name: 'completeName',
  fields:  {
    firstName: NucleoString,
    lastName: NucleoString
  }
});

const userTestType = new NucleoObject({
  name: 'userTest',
  fields: {
    name: completeNameType,
    age: NucleoNumber
  }
});

Structure

Inside NucleoObject it has two attributes you must know about:

  • name: it is a string and it's value is used to create its store name and place in store
  • fields: it is an object and is used to define your object attributes and their Nucleo Types. To check the possibilities, see the Nucleo Types docs.
Clone this wiki locally