source: node_modules/d3-selection/src/selection/property.js@ e4c61dd

Last change on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago

Prototype 1.1

  • Property mode set to 100644
File size: 617 bytes
Line 
1function propertyRemove(name) {
2 return function() {
3 delete this[name];
4 };
5}
6
7function propertyConstant(name, value) {
8 return function() {
9 this[name] = value;
10 };
11}
12
13function propertyFunction(name, value) {
14 return function() {
15 var v = value.apply(this, arguments);
16 if (v == null) delete this[name];
17 else this[name] = v;
18 };
19}
20
21export default function(name, value) {
22 return arguments.length > 1
23 ? this.each((value == null
24 ? propertyRemove : typeof value === "function"
25 ? propertyFunction
26 : propertyConstant)(name, value))
27 : this.node()[name];
28}
Note: See TracBrowser for help on using the repository browser.