Skip to content

Commit 21bee85

Browse files
committed
feat: mapKeysDeep implemented #26
1 parent 6e2097f commit 21bee85

File tree

132 files changed

+1722
-1448
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+1722
-1448
lines changed

CHANGELOG.md

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
*(2020-03-21)*
55

66
**Breaking Changes**
7-
- mapDeep renamed to [mapValuesDeep](/#mapvaluesdeep) to conform to Lodash map/mapValues pair of methods.
8-
- [mapDeep](/#mapdeep) re-implemented to return an array of deep values processed by iteratee.
7+
- mapDeep renamed to [mapValuesDeep](/#mapvaluesdeep) to conform to Lodash map/mapValues/mapKeys family of methods.
8+
- [mapDeep](/#mapdeep) re-implemented to return an array of deep values processed by iteratee (same as _.map in Lodash)
9+
10+
**Features added**
11+
- [mapKeysDeep](/#mapkeysdeep) implemented - returns object with same values but keys modified by iteratee (same as _.mapKeys in Lodash)
912

1013
## v4-6-0
1114
*(2020-03-21)*

README.md

+18-2
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ let children = [
634634
<summary>expand example</summary>
635635

636636
```js
637-
let res = _.mapValuesDeep(
637+
let res = _.mapDeep(
638638
{ hello: { from: { the: 'deep world', and: 'deepdash' } } },
639639
(v) => v.toUpperCase(),
640640
{ leavesOnly: true }
@@ -646,7 +646,7 @@ let children = [
646646
[Try it yourself (no yet) ›››](https://codepen.io/yurigor)
647647

648648
### mapValuesDeep
649-
› get the same object, but different. [📚 see docs](https://deepdash.io/#mapvaluesdeep)
649+
› get the object with same structure, but transformed values. [📚 see docs](https://deepdash.io/#mapvaluesdeep)
650650
<details>
651651
<summary>expand example</summary>
652652

@@ -662,6 +662,22 @@ let children = [
662662

663663
[Try it yourself ›››](https://codepen.io/yurigor/pen/yWBzGV?editors=0010)
664664

665+
### mapKeysDeep
666+
› get the object with same values, but transformed keys. [📚 see docs](https://deepdash.io/#mapkeysdeep)
667+
<details>
668+
<summary>expand example</summary>
669+
670+
```js
671+
let res = _.mapKeysDeep(
672+
{ hello: { from: { the: 'deep world' } } },
673+
(v, k) => k.toUpperCase()
674+
);
675+
// res -> { HELLO: { FROM: { THE: 'deep world' } } }
676+
```
677+
</details>
678+
679+
[Try it yourself (no yet) ›››](https://codepen.io/yurigor/)
680+
665681
### reduceDeep
666682
› like reduce, but deep [📚 see docs](https://deepdash.io/#reducedeep)
667683
<details>

addMapKeysDeep.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict';
2+
3+
var getMixOrPatchIn = require('./private/getMixOrPatchIn.js');
4+
var getMapKeysDeep = require('./getMapKeysDeep.js');
5+
6+
/* build/tpl */
7+
8+
function addMapKeysDeep(_) {
9+
var mixOrPatchIn = getMixOrPatchIn(_);
10+
return mixOrPatchIn('mapKeysDeep', getMapKeysDeep(_), !getMapKeysDeep.notChainable);
11+
}
12+
13+
module.exports = addMapKeysDeep;

browser/deepdash.js

+119-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

browser/deepdash.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)