mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
Add utility chain function to remove items from a set.
This commit is contained in:
parent
f8f76d9303
commit
b4e79c42d2
14
lib/unset.js
Normal file
14
lib/unset.js
Normal file
@ -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;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user