key-renamer
Since: 06/04/2015 Author: Thales Pinheiro
Overview
A JS library to deep rename object keys based on a map.
Features
- Deep structure renamer
- Blazing fast (~2ms and ~5,737 ops/sec)!
- Low footprint (~1KB)
Installation
npm install key-renamer --save
Usage
Given this sample object:
const data = a: 1 b: 'John' c: 34 d: 500000 e: f: 10 active: true;
and this sample map object:
const map = a: 'id' b: 'name' c: 'age' d: '{project: {value: {total: $value}}}' e: 'git' f: '{repository: {url: $value}}';
running:
const keyRenamer = ;console;
the output transformed object should be:
const updatedObject = id: 1 name: 'John' age: 34 project: value: total: 500000 git: repository: url: 10 active: true;
Benchmark and Tests
- Clone this repository
npm install
- To test
npm run test
- To benchmark
npm run benchmark