JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 640
  • Score
    100M100P100Q117227F
  • License MIT

Recursion replace object key use map.

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.

version license size download

installation

npm install -S @jswork/next-key-map

apis

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.