Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

y0hami/circle-assign

Repository files navigation

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');
  }
}