mirror of
https://github.com/shimataro/ssh-key-action.git
synced 2025-06-19 22:52:10 +10:00
* first action! (#1)
This commit is contained in:
parent
8deacc95b1
commit
ace1e6a69a
3750 changed files with 1155519 additions and 0 deletions
26
node_modules/semver-utils/test/deepOwnEqual.js
generated
vendored
Normal file
26
node_modules/semver-utils/test/deepOwnEqual.js
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
var assert = require('chai').assert;
|
||||
|
||||
// we need to define our own deepEqual function that ignores properties that are not hasOwnProperty. Not supported in chai.assert.deepEqual as of v3.0.0.
|
||||
function deepOwnEqual(a, b) {
|
||||
|
||||
// if arrays of objects, recurse down to the objects
|
||||
if(Array.isArray(a) && Array.isArray(b)) {
|
||||
assert.deepEqual(a.length, b.length, 'Arrays have different lengths')
|
||||
for(var i=0; i<a.length; i++) {
|
||||
deepOwnEqual(a[i], b[i])
|
||||
}
|
||||
}
|
||||
// compare all the object properties
|
||||
else {
|
||||
var aKeys = Object.keys(a);
|
||||
var bKeys = Object.keys(b);
|
||||
|
||||
assert.deepEqual(aKeys, bKeys, 'Objects have different keys');
|
||||
|
||||
aKeys.forEach(function(key) {
|
||||
assert.deepEqual(a[key], b[key], 'Expected values of "' + key + '" property to be equal in each object')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = deepOwnEqual
|
Loading…
Add table
Add a link
Reference in a new issue