Package Exports
- @jswork/next-key-map
- @jswork/next-key-map/dist/index.esm.js
- @jswork/next-key-map/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@jswork/next-key-map) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
next-key-map
Recursion replace object key use map.
installation
npm install -S @jswork/next-key-mapapis
| API | TYPE | DESCRIPTION |
|---|---|---|
| keyMap | { sourceKey: targetKey} | Map source to target |
usage
import '@jswork/next-key-map';
const data = {
key: '1',
name: 'Zhong Hua Men',
desc: 'lsjdflsjdflsdjflsjdf'
};
const rs = nx.keyMap( data,{
key:'id',
name:'value',
desc:'description'
});
// or use id:value replacer
const rs2 = nx.keyMap(data, 'key:id; name:value; desc:description');
// results:
const data = {
id: '1',
value: 'Zhong Hua Men',
description: 'lsjdflsjdflsdjflsjdf'
};license
Code released under the MIT license.