/circle-assign

Simple deep object assign function

Primary LanguageJavaScriptMIT LicenseMIT

circle-assign logo

circle-assign

circle-assign is a simple deep object assign function and can be used in nodejs and the browser

Build Status Coverage Status npm version license

Installation

$ npm install --save circle-assign

Syntax

circleAssign(target, ...sources)

Usage

NodeJS

const circleAssign = require('circle-assign');

Browser (ES6)

import circleAssign from 'circle-assign';

Browser (CDN)

<script
  type="application/javascript"
  src="https://cdn.jsdelivr.net/npm/circle-assign@2.0.0/dist/circle-assign.min.js"
/>
const a = {
  language: 'javascript',
  features: {
    recursive: true,
    size: 'small'
  }
};

const b = {
  language: 'JavaScript',
  opensource: true,
  features: {
    size: '~1.3kb',
    canMergeFunctions: true
  }
};

const c = {
  coolFunc: () => {
    console.log('Much wow');
  }
};

console.log(circleAssign(a, b, c));

Output

{
  language: "JavaScript",
  opensource: true,
  features: {
    recursive: true,
    size: "~1.3kb",
    canMergeFunctions: true
  },
  coolFunc: () => {
    console.log('Much wow');
  }
}