Avoid confusing prototype methods for static methods
Correct: `Array.from()` (it’s a static method) Incorrect: `Array.join()` (doesn’t exist; it’s a prototype method) This patch uses the common `#` syntax to denote `.prototype.`.
This commit is contained in:
@ -2,8 +2,8 @@
|
||||
|
||||
Unflatten an object with the paths for keys.
|
||||
|
||||
Use `Object.keys(obj)` combined with `Array.reduce()` to convert flattened path node to a leaf node.
|
||||
If the value of a key contains a dot delimiter (`.`), use `Array.split('.')`, string transformations and `JSON.parse()` to create an object, then `Object.assign()` to create the leaf node.
|
||||
Use `Object.keys(obj)` combined with `Array.prototype.reduce()` to convert flattened path node to a leaf node.
|
||||
If the value of a key contains a dot delimiter (`.`), use `Array.prototype.split('.')`, string transformations and `JSON.parse()` to create an object, then `Object.assign()` to create the leaf node.
|
||||
Otherwise, add the appropriate key-value pair to the accumulator object.
|
||||
|
||||
```js
|
||||
|
||||
Reference in New Issue
Block a user