isClone
Deep compare two objects/values and return true if one is a clone of other
Setup
1. Install
npm install isclone
Usage
const isClone = //Primitive types // FALSE // TRUE // TRUE // TRUE // TRUE // FALSE // TRUE // TRUE // FALSE //Primitive types and builtin objects // FALSE // TRUE // FALSE // FALSE // TRUE // FALSE // TRUE // TRUEconst now = // TRUE // FALSEconst re = /^$/imsg // TRUE // TRUE // FALSE // FALSE //Arays and binary arrays // TRUE // FALSE // TRUE // FALSE // TRUE // FALSE // TRUE // Functions (by default two function are equal if and only if they both refere to same code/object)const f = {}const g = {} // FALSE // TRUE //Literal Objectsconst x = i: 1 const y = i: 1 // TRUE //Nest Objectsconst z = a: x const w = a: y // TRUE //Object membersw {} // FALSE //User defined Objects { thisi = i } { thisi = i } // FALSEconst a = 3 // TRUE // FALSEconst b = 3 // FALSE //Setsconst s = x a // TRUE // TRUE // FALSE //Mapsconst m = x a y a // TRUE // TRUE // FALSE // Class instances{} // FALSEconst c = // TRUE // Inheritance {} // FALSEconst d = // FALSE // TRUE // Changing an instance property { thisi = i } { thisi++ }const e = 0 // TRUEe{} // FALSE // Nested objects { thise = i }const de = 0 // TRUE // TRUE // TRUE // TRUEdex = 'x' // FALSE // Circular referencesxi = xyi = x // TRUExi = xyi = y // TRUExi = yyi = x // TRUE // Subclasses of builtin typesconst abc = 'abc' {supers} // TRUE // FALSE abclabel = 'label' // FALSE const one = 1onelabel = 'label' // FALSE const bool = trueboollabel = 'label' // FALSE const d1st = 'December 1, 1995 00:00:00' // TRUEd1stlabel = 'label' // FALSE const regexp = /^.+$/imsg // TRUEregexplabel = 'label' // FALSE const array = 1 2 // TRUEarraylabel = 'label' // FALSE {supers} // TRUE // FALSE const set = 1 2 // TRUEsetlabel = 'label' // FALSE const map = 1 2 23 // TRUEmaplabel = 'label' // FALSE // Prototype inheritance { thisn = n }Aprototype { thisn += n }const obja = 1 // TRUE // FALSE { A } // FALSEBprototype = Object // FALSEBprototype { this; }Bprototypeconstructor = B // FALSEconst objb = 1 // TRUE // FALSEobjb {} // FALSE