Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

model-attributes

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

model-attributes

attribute meta description

  • 3.0.8
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
increased by47.48%
Maintainers
1
Weekly downloads
 
Created
Source

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

  • model-attributes

model-attributes.setAttributes(dest, atts, src, cb, prefix) ⇒

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

Kind: static method of model-attributes
Returns: void

ParamTypeDescription
destObjecttarget object to be modified
attsObjectattribute definitions to be used
srcObjectorigin of the data to be copied
cbfunctioncallback to be executed for each copied value
prefixStringname prefix used for all attributes

model-attributes.getAttribute(object, atts, path) ⇒ Any

Delivers a attribute value for a given attribute name

Kind: static method of model-attributes
Returns: Any - attribute value

ParamTypeDescription
objectObjectto query
attsObjectattribute definitions to be used
pathStringattribute name

model-attributes.getAttributes(object, attributes, options) ⇒ Object

Retrive attribute values from an object

Kind: static method of model-attributes
Returns: Object - values

ParamTypeDescription
objectObjectattribute value source
attributesObject
optionsObject

model-attributes.createAttributes(definitions) ⇒ Object

Create attributes from its definition

Kind: static method of model-attributes
Returns: Object - attributes

ParamType
definitionsObject

model-attributes.mergeAttributes(dest, atts) ⇒ Object

Merge attribute definitions

Kind: static method of model-attributes
Returns: Object - merged definitions (dest)

ParamTypeDescription
destObjectattribute definitions to be used also the merge target
attsObjectattribute definitions to be used

install

With npm do:

npm install model-attributes

license

BSD-2-Clause

Keywords

FAQs

Package last updated on 10 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc