All Projects → jonschlinkert → rename-keys

jonschlinkert / rename-keys

Licence: MIT license
Modify/rename the keys of the own enumerable properties of an object.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to rename-keys

omit-empty
Recursively omit empty properties from an object. Omits empty objects, arrays, strings, and optionally zero. Similar results to what you would expect with `compact` for arrays.
Stars: ✭ 71 (+153.57%)
Mutual labels:  object, keys
expand-hash
Recursively expands property keys with dot-notation into objects.
Stars: ✭ 25 (-10.71%)
Mutual labels:  object, keys
object.omit
Return a copy of an object without the given keys.
Stars: ✭ 79 (+182.14%)
Mutual labels:  object, properties
stringify-keys
Build an array of key paths from an object.
Stars: ✭ 18 (-35.71%)
Mutual labels:  object, keys
object-keys
Object.keys shim
Stars: ✭ 41 (+46.43%)
Mutual labels:  object, keys
CarND-VehicleDetection
vehicle detection with deep learning
Stars: ✭ 34 (+21.43%)
Mutual labels:  object
is-string
Is this value a JS String object or primitive? This module works cross-realm/iframe, and despite ES6 @@toStringTag.
Stars: ✭ 17 (-39.29%)
Mutual labels:  object
cryptouri.rs
Rust implementation of CryptoURI: URN-like namespace for cryptographic objects with Bech32-based encoding
Stars: ✭ 33 (+17.86%)
Mutual labels:  keys
cocktail
Traits, Talents & Annotations for NodeJS.
Stars: ✭ 65 (+132.14%)
Mutual labels:  properties
magicproperties
A little but powerful package that allows you call getters and setters implicitly in PHP.
Stars: ✭ 13 (-53.57%)
Mutual labels:  properties
ECS-CommunityEdition
ECS Community Edition "Free & Frictionless"
Stars: ✭ 125 (+346.43%)
Mutual labels:  object
Excel2Object
excel convert to .NET Object | Excel与.NET 对象进行转换,支持公式、多Sheet等功能
Stars: ✭ 35 (+25%)
Mutual labels:  object
javascript-easy-object
Now easily access or modify an object in javascript with javascript-easy-object.
Stars: ✭ 13 (-53.57%)
Mutual labels:  object
object.pick
(object pick) returns a filtered copy of an object with only the specified keys, exactly like `pick` from lo-dash / underscore.
Stars: ✭ 39 (+39.29%)
Mutual labels:  object
copy-anything
An optimised way to copy'ing (cloning) an Object or Array. A small and simple integration
Stars: ✭ 19 (-32.14%)
Mutual labels:  object
Object.getOwnPropertyDescriptors
Spec-compliant shim for `Object.getOwnPropertyDescriptors` that works in ES5.
Stars: ✭ 19 (-32.14%)
Mutual labels:  object
PropertiesFile4Delphi
Library for managing configuration files with key-value syntax
Stars: ✭ 17 (-39.29%)
Mutual labels:  properties
object-book
Study Object book Content Repository / 조영호 님의 오브젝트 책을 학습하고 정리한 Repo입니다.
Stars: ✭ 30 (+7.14%)
Mutual labels:  object
SemanticExtraSpecialProperties
Provides extra special properties to Semantic MediaWiki.
Stars: ✭ 24 (-14.29%)
Mutual labels:  properties
transfer
Converts from one encoding to another. Supported formats HCL ⇄ JSON ⇄ YAML⇄TOML⇄XML⇄plist⇄pickle⇄properties ...
Stars: ✭ 70 (+150%)
Mutual labels:  properties

rename-keys NPM version NPM monthly downloads NPM total downloads Linux Build Status

Modify the names of the own enumerable properties (keys) of an object.

Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your ❤️ and support.

Install

Install with npm:

$ npm install --save rename-keys

Usage

var renameKeys = require('rename-keys');

API

Params

  • object {Object}: The object with keys to rename.
  • fn {Function}: Renaming function to use on each key in the object.
  • returns {Object}: Returns a new object with renamed keys.

Example

var obj = renameKeys({a: 1, b: 2, c: 3}, function(key, val) {
  return '--' + key;
});
console.log(obj);
//=> { '--a': 1, '--b': 2, '--c': 3}

Rename based on value

var obj = renameKeys({a: 1, b: 2, c: 3}, function(key, val) {
  return val > 1 ? ('++' + key) : ('--' + key);
});
console.log(obj);
//=> {'--a': 1, '++b': 2, '++c': 3};

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Contributors

Commits Contributor
15 jonschlinkert
5 doowb
2 stellard
1 kof
1 robinbullocks4rb
1 palanik

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on October 13, 2017.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].