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

accretion

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

accretion

JS object used to accumulate data

  • 0.1.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

An accretion is an extensible object used an an alternative to this, class, and new.

const {create} = require('accretion');

const a = create({
    foo: 'default value'
});

// b shallow copies a and overrides properties
const b = a.extend({
    foo: 'overriding value',
    bar: 'new property'
});

// c shallow copies b, and lets b override provided values.
const c = b.spread({
    foo: 'new default value'
});

delete b.foo;

const d = b.spread({
    foo: 'new default value if property is not already specified'
});

// {foo: 'default value', spread: [Function], extend: [Function] }
console.log(a);

// {foo: 'overriding value', bar: 'new property', spread, extend }
console.log(b);

// {foo: 'overriding value', bar: 'new property', spread, extend }
console.log(c);

// {foo: 'new default value', bar: 'new property', spread, extend }
console.log(d);

FAQs

Package last updated on 29 Jul 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