diff --git a/lib/unset.js b/lib/unset.js new file mode 100644 index 00000000..93ac47fb --- /dev/null +++ b/lib/unset.js @@ -0,0 +1,14 @@ +if(typeof window !== "undefined"){ + var Gun = window.Gun; +} else { + var Gun = require('gun/gun'); +} + +const rel_ = Gun.val.rel._; // '#' +const node_ = Gun.node._; // '_' + +Gun.chain.unset = function(node){ + if( this && node && node[node_] && node[node_].put && node[node_].put[node_] && node[node_].put[node_][rel_] ) + this.put( { [node[node_].put[node_][rel_]]:null} ); + return this; +}