deep-same
v1.0.2
Published
Simple module to compare 2 variables
Downloads
1
Maintainers
Readme
deep-same
Simple module to compare 2 variables
V1.0.2
How to use?
To compare 2 objects
const deepSame = require('deep-same');
const aFirstRandomObject = { forExemple: 'Yes' };
const aFirstRandomObjectModel = { forExemple: 'Do you like deep-same?' };
deepSame(aFirstRandomObject, aFirstRandomObjectModel);
// false
// Because the objects are not the same
const aSecondRandomObject = { forExemple: 'Do you like deep-same?' };
const aSecondRandomObjectModel = { forExemple: 'Do you like deep-same?' };
deepSame(aSecondRandomObject, aSecondRandomObjectModel);
// true
// Because the objects are the same
To compare 2 arrays
const deepSame = require('deep-same');
const aFirstRandomArray = ['Yes'];
const aFirstRandomArrayModel = ['Do you like deep-same?'];
deepSame(aFirstRandomArray, aFirstRandomArrayModel);
// false
// Because the arrays are not the same
const aSecondRandomArray = ['Do you like deep-same?'];
const aSecondRandomArrayModel = ['Do you like deep-same?'];
deepSame(aSecondRandomArray, aSecondRandomArrayModel);
// true
// Because the arrays are the same
To compare 2 variables of another type
const deepSame = require('deep-same');
const aFirstRandomVariable = 'Yes';
const aFirstRandomVariableModel = 'Do you like deep-same?';
deepSame(aFirstRandomVariable, aFirstRandomVariableModel);
// false
// Because the variables are not the same
const aSecondRandomVariable = 'Do you like deep-same?';
const aSecondRandomVariableModel = 'Do you like deep-same?';
deepSame(aSecondRandomVariable, aSecondRandomVariableModel);
// true
// Because the variables are the same