Created
July 18, 2019 14:37
-
-
Save bitnom/89ba6bb735d59ba3db0ea4f298e77029 to your computer and use it in GitHub Desktop.
gun unique
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isu(node, item){ | |
node.map().once(function (data) { | |
let aProps = Object.getOwnPropertyNames(data); | |
let bProps = Object.getOwnPropertyNames(item); | |
// number of properties | |
if (aProps.length === bProps.length) { | |
console.log("same len") | |
for (let i = 0; i < aProps.length; i++) { | |
let propName = aProps[i]; | |
// values of same property | |
if (a[propName] === b[propName]) { | |
console.log("match") | |
return false | |
} | |
} | |
} | |
// not equivalent | |
//return true; | |
}) | |
//node.set(item) | |
//resolve(true) | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment