Skip to content

Commit 632f0a3

Browse files
author
javadoug
committed
update comments
1 parent 132276b commit 632f0a3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/index.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
module.exports = {
33
'get': function (obj, path) {
44
// supports a.b, a[1] and foo[bar], etc.
5-
// where obj is ['nope', 'yes', {a: {b: 1}, foo: 2}]
5+
// for example: where obj is ['nope', 'yes', {a: {b: 1}, foo: 2}]
66
// then [1] returns 'yes'; [2].a.b returns 1; [2].a[foo] returns 2;
77
path = path.split(/[\.\[\]]/).filter(d => d);
88
return path.reduce((r, p) => {
@@ -12,9 +12,8 @@ module.exports = {
1212
}, obj);
1313
},
1414
'set': function (obj, path, value) {
15-
// todo: replace implementation of assignPathValue with this impl and
16-
// remove updatePathValue (only need one function, not both)
17-
// same as assignPathValue except removes property if value is undefined
15+
// assign property creates Objects and Arrays as needed
16+
// removes property if typeof(value) is undefined
1817
path = path.split(/[\.\[\]]/).filter(d => d);
1918
const isRemove = typeof value === 'undefined';
2019
// enable look-ahead to determine if type is array or object

0 commit comments

Comments
 (0)