Test performance improvements by trimming views
This commit is contained in:
@ -3,10 +3,9 @@ title: deepMapKeys
|
||||
tags: object,recursion,advanced
|
||||
---
|
||||
|
||||
Deep maps an object keys.
|
||||
Deep maps an object's keys.
|
||||
|
||||
Creates an object with the same values as the provided object and keys generated by running the provided function for each key.
|
||||
|
||||
Use `Object.keys(obj)` to iterate over the object's keys.
|
||||
Use `Array.prototype.reduce()` to create a new object with the same values and mapped keys using `fn`.
|
||||
|
||||
|
||||
@ -5,11 +5,11 @@ tags: adapter,function,promise,intermediate
|
||||
|
||||
Converts an asynchronous function to return a promise.
|
||||
|
||||
*In Node 8+, you can use [`util.promisify`](https://nodejs.org/api/util.html#util_util_promisify_original)*
|
||||
|
||||
Use currying to return a function returning a `Promise` that calls the original function.
|
||||
Use the `...rest` operator to pass in all the parameters.
|
||||
|
||||
*In Node 8+, you can use [`util.promisify`](https://nodejs.org/api/util.html#util_util_promisify_original)*
|
||||
|
||||
```js
|
||||
const promisify = func => (...args) =>
|
||||
new Promise((resolve, reject) =>
|
||||
|
||||
@ -8,8 +8,6 @@ Mutates the original array to filter out the values specified.
|
||||
Use `Array.prototype.filter()` and `Array.prototype.includes()` to pull out the values that are not needed.
|
||||
Use `Array.prototype.length = 0` to mutate the passed in an array by resetting it's length to zero and `Array.prototype.push()` to re-populate it with only the pulled values.
|
||||
|
||||
_(For a snippet that does not mutate the original array see [`without`](#without))_
|
||||
|
||||
```js
|
||||
const pull = (arr, ...args) => {
|
||||
let argState = Array.isArray(args[0]) ? args[0] : args;
|
||||
|
||||
@ -9,7 +9,6 @@ Get type of `val` (`array`, `object` or `string`).
|
||||
Use `length` property for arrays.
|
||||
Use `length` or `size` value if available or number of keys for objects.
|
||||
Use `size` of a [`Blob` object](https://developer.mozilla.org/en-US/docs/Web/API/Blob) created from `val` for strings.
|
||||
|
||||
Split strings into array of characters with `split('')` and return its length.
|
||||
|
||||
```js
|
||||
|
||||
@ -7,8 +7,6 @@ Filters out the elements of an array, that have one of the specified values.
|
||||
|
||||
Use `Array.prototype.filter()` to create an array excluding(using `!Array.includes()`) all given values.
|
||||
|
||||
_(For a snippet that mutates the original array see [`pull`](#pull))_
|
||||
|
||||
```js
|
||||
const without = (arr, ...args) => arr.filter(v => !args.includes(v));
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user