JSPM

  • Created
  • Published
  • Downloads 552
  • Score
    100M100P100Q38519F
  • License BSD-2-Clause

attribute meta description

Package Exports

  • model-attributes

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (model-attributes) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

npm semantic-release Build Status bithound codecov.io Coverage Status Code Climate Known Vulnerabilities GitHub Issues Stories in Ready Dependency Status devDependency Status docs downloads Commitizen friendly

model-attributes

attribute meta description

const ma = require('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

API Reference

setAttributes(dest, atts, src, cb, prefix) ⇒

Copies attribute values from a source object into a destination object.

Kind: global function
Returns: void

Param Type Description
dest Object target object to be modified
atts Object attribute definitions to be used
src Object origin of the data to be copied
cb function callback to be executed for each copied value
prefix String name prefix used for all attributes

getAttribute(object, atts, path) ⇒ Any

Delivers a attribute value for a given attribute name

Kind: global function
Returns: Any - attribute value

Param Type Description
object Object to query
atts Object attribute definitions to be used
path String attribute name

install

With npm do:

npm install model-attributes

license

BSD-2-Clause