diff --git a/snippets/findLastKey.md b/snippets/findLastKey.md index f076b8451..9f7ad855a 100644 --- a/snippets/findLastKey.md +++ b/snippets/findLastKey.md @@ -8,7 +8,7 @@ lastUpdated: 2020-10-22T20:23:47+03:00 Finds the last key that satisfies the provided testing function. Otherwise `undefined` is returned. -- Use `Object.keys(obj)` to get all the properties of the object. +- Use `Object.keys()` to get all the properties of the object. - Use `Array.prototype.reverse()` to reverse the order and `Array.prototype.find()` to test the provided function for each key-value pair. - The callback receives three arguments - the value, the key and the object. diff --git a/snippets/flattenObject.md b/snippets/flattenObject.md index ab871487c..a4b1f4418 100644 --- a/snippets/flattenObject.md +++ b/snippets/flattenObject.md @@ -8,7 +8,7 @@ lastUpdated: 2020-10-19T18:51:03+03:00 Flattens an object with the paths for keys. - Use recursion. -- Use `Object.keys(obj)` combined with `Array.prototype.reduce()` to convert every leaf node to a flattened path node. +- Use `Object.keys()` combined with `Array.prototype.reduce()` to convert every leaf node to a flattened path node. - If the value of a key is an object, the function calls itself with the appropriate `prefix` to create the path using `Object.assign()`. - Otherwise, it adds the appropriate prefixed key-value pair to the accumulator object. - You should always omit the second argument, `prefix`, unless you want every key to have a prefix. diff --git a/snippets/forOwn.md b/snippets/forOwn.md index 8e795dbde..bf259617b 100644 --- a/snippets/forOwn.md +++ b/snippets/forOwn.md @@ -7,7 +7,7 @@ lastUpdated: 2020-10-22T20:23:47+03:00 Iterates over all own properties of an object, running a callback for each one. -- Use `Object.keys(obj)` to get all the properties of the object. +- Use `Object.keys()` to get all the properties of the object. - Use `Array.prototype.forEach()` to run the provided function for each key-value pair. - The callback receives three arguments - the value, the key and the object. diff --git a/snippets/forOwnRight.md b/snippets/forOwnRight.md index 9c8e87362..7c41f033d 100644 --- a/snippets/forOwnRight.md +++ b/snippets/forOwnRight.md @@ -7,7 +7,7 @@ lastUpdated: 2020-10-19T22:49:51+03:00 Iterates over all own properties of an object in reverse, running a callback for each one. -- Use `Object.keys(obj)` to get all the properties of the object, `Array.prototype.reverse()` to reverse their order. +- Use `Object.keys()` to get all the properties of the object, `Array.prototype.reverse()` to reverse their order. - Use `Array.prototype.forEach()` to run the provided function for each key-value pair. - The callback receives three arguments - the value, the key and the object. diff --git a/snippets/functions.md b/snippets/functions.md index 2d17f4460..45642462e 100644 --- a/snippets/functions.md +++ b/snippets/functions.md @@ -7,8 +7,8 @@ lastUpdated: 2020-10-20T11:21:07+03:00 Gets an array of function property names from own (and optionally inherited) enumerable properties of an object. -- Use `Object.keys(obj)` to iterate over the object's own properties. -- If `inherited` is `true`, use `Object.getPrototypeOf(obj)` to also get the object's inherited properties. +- Use `Object.keys()` to iterate over the object's own properties. +- If `inherited` is `true`, use `Object.getPrototypeOf()` to also get the object's inherited properties. - Use `Array.prototype.filter()` to keep only those properties that are functions. - Omit the second argument, `inherited`, to not include inherited properties by default. diff --git a/snippets/objectToQueryString.md b/snippets/objectToQueryString.md index 4b1f14480..c645487d5 100644 --- a/snippets/objectToQueryString.md +++ b/snippets/objectToQueryString.md @@ -7,7 +7,7 @@ lastUpdated: 2020-10-22T20:24:04+03:00 Generates a query string from the key-value pairs of the given object. -- Use `Array.prototype.reduce()` on `Object.entries(queryParameters)` to create the query string. +- Use `Array.prototype.reduce()` on `Object.entries()` to create the query string from `queryParameters`. - Determine the `symbol` to be either `?` or `&` based on the length of `queryString`. - Concatenate `val` to `queryString` only if it's a string. - Return the `queryString` or an empty string when the `queryParameters` are falsy. diff --git a/snippets/pickBy.md b/snippets/pickBy.md index a4200315d..8ad6ea096 100644 --- a/snippets/pickBy.md +++ b/snippets/pickBy.md @@ -7,7 +7,7 @@ lastUpdated: 2020-10-22T20:24:04+03:00 Creates an object composed of the properties the given function returns truthy for. -- Use `Object.keys(obj)` and `Array.prototype.filter()`to remove the keys for which `fn` returns a falsy value. +- Use `Object.keys()` and `Array.prototype.filter()`to remove the keys for which `fn` returns a falsy value. - Use `Array.prototype.reduce()` to convert the filtered keys back to an object with the corresponding key-value pairs. - The callback function is invoked with two arguments: (value, key).