Object

Methods

(static) clone(objectnon-null) → {T}

Returns deep copy from object
Parameters:
Name Type Description
object T The object
Source:
Example
import { clone } from 'main-fns';

const userInfo = {
  user: {
    name: 'Iván',
    alias: 'nabby27'
  },
  github: 'https://github.com/nabby27'
};

const userInfoCloned = clone(userInfo);

console.log(userInfoCloned === userInfo); // false
console.log(userInfoCloned.name); // 'Iván'

(static) isEqual(objectnon-null, otherObjectnon-null) → {boolean}

Returns if objects are deep equal
Parameters:
Name Type Description
object T The object
otherObject T The object to compare
Source:
Example
import { isEqual } from 'main-fns';

const userInfo = {
  user: {
    name: 'Iván',
    alias: 'nabby27'
  },
  github: 'https://github.com/nabby27'
};

const userInfo2 = {
  user: {
    name: 'Example',
    alias: 'ex123'
  },
  github: ''
};

console.log(isEqual(userInfo, userInfo2)); // false