Initial commit
This commit is contained in:
27
node_modules/d3-selection/src/local.js
generated
vendored
Normal file
27
node_modules/d3-selection/src/local.js
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
var nextId = 0;
|
||||
|
||||
export default function local() {
|
||||
return new Local;
|
||||
}
|
||||
|
||||
function Local() {
|
||||
this._ = "@" + (++nextId).toString(36);
|
||||
}
|
||||
|
||||
Local.prototype = local.prototype = {
|
||||
constructor: Local,
|
||||
get: function(node) {
|
||||
var id = this._;
|
||||
while (!(id in node)) if (!(node = node.parentNode)) return;
|
||||
return node[id];
|
||||
},
|
||||
set: function(node, value) {
|
||||
return node[this._] = value;
|
||||
},
|
||||
remove: function(node) {
|
||||
return this._ in node && delete node[this._];
|
||||
},
|
||||
toString: function() {
|
||||
return this._;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user