Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/odynvolk/map-keys-deep-lodash
Map/rename keys recursively with Lodash
https://github.com/odynvolk/map-keys-deep-lodash
deep javascript lodash map npm
Last synced: 3 months ago
JSON representation
Map/rename keys recursively with Lodash
- Host: GitHub
- URL: https://github.com/odynvolk/map-keys-deep-lodash
- Owner: odynvolk
- License: mit
- Created: 2016-04-27T19:23:08.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-04-17T04:52:04.000Z (almost 2 years ago)
- Last Synced: 2024-06-18T18:40:43.033Z (7 months ago)
- Topics: deep, javascript, lodash, map, npm
- Language: JavaScript
- Size: 1.91 MB
- Stars: 17
- Watchers: 1
- Forks: 2
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# map-keys-deep-lodash
> Map/rename keys recursivelySometimes we need to map keys from an object recursively. map-keys-deep-lodash solves this and uses only lodash as external
dependency.The code for this module uses new features in the Javascript language, but the code is transpiled by Babel to ES2015 so most projects who needs it should be able to use it.
## Install
Install with [npm](https://www.npmjs.com/)
```sh
$ npm i map-keys-deep-lodash --save
```## Usage
```js
const mapKeysDeep = require("map-keys-deep-lodash");mapKeysDeep({a: "b", c: "d", e: {c: "f", g: {c: "h"}}}, (value, key) => {
if (key === "c") {
return "zzz";
}return key;
});
//=> {a: "b", zzz: "d", e: {zzz: "f", g: {zzz: "h"}}}
```## Related projects
* [lodash](https://github.com/lodash/lodash): The only external dependency. [more](https://github.com/lodash/lodash)
## Running tests
Install dev dependencies:
```sh
$ npm i -d && npm test
```## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/odynvolk/map-keys-deep-lodash/issues/new)
## Author
+ [github/odynvolk](https://github.com/odynvolk)
+ [github/goliney](https://github.com/goliney)## License
Released under the MIT license.