binhend 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/binh.js +16 -2
package/package.json
CHANGED
package/src/binh.js
CHANGED
|
@@ -43,7 +43,21 @@ function Binh() {
|
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
binh.config = function(key) {
|
|
46
|
-
|
|
46
|
+
if (typeof key !== 'string') return config;
|
|
47
|
+
|
|
48
|
+
if (config.hasOwnProperty(key)) return config[key];
|
|
49
|
+
|
|
50
|
+
var pointer = config, keys = key.split('.'), length = keys.length;
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
for (var i = 0; i < length; i++) {
|
|
54
|
+
pointer = pointer[keys[i]];
|
|
55
|
+
}
|
|
56
|
+
return pointer;
|
|
57
|
+
}
|
|
58
|
+
catch (e) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
47
61
|
};
|
|
48
62
|
|
|
49
63
|
binh.config.reload = function() {
|
|
@@ -122,7 +136,7 @@ function Binh() {
|
|
|
122
136
|
this.port.value = port;
|
|
123
137
|
}
|
|
124
138
|
else if (typeof port === 'string') {
|
|
125
|
-
this.port.value = config
|
|
139
|
+
this.port.value = binh.config(port);
|
|
126
140
|
}
|
|
127
141
|
return this;
|
|
128
142
|
};
|