attribute meta description
const { createAttributes } from 'model-attributes';
const attributes = ma.createAttributes({
att1: {},
att2: { datault: 2}
});
const object = {};
ma.setAttributes(object, attributes, {
att1: 'value1'
});
console.log(object.att1); // value1
console.log(object.att2); // 2
Copies attribute values from a source object into a destination object.
dest
Object target object to be modifiedatts
Object attribute definitions to be usedsrc
Object origin of the data to be copiedcb
function callback to be executed for each copied valueprefix
string name prefix used for all attributes
Returns void
Delivers a attribute value for a given attribute name
Returns Any attribute value
Retrive attribute values from an object.
Returns Object values
Create attributes from its definition.
definitions
Object
Returns Object attributes
Merge attribute definitions.
dest
Object attribute definitions to be used also the merge targetatts
Object attribute definitions to be used
Returns Object merged definitions (dest)
With npm do:
npm install model-attributes