Package Exports
- replace-key
- replace-key/replace-key.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 (replace-key) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
replace-key
Replace the Key in an Object
features
- simple
- universal support (AMD, CJS, IIFE, and ESM)
- works in Web Workers
install
npm install replace-keyusage
const replaceKey = require("replace-key");
const obj = { a: 1 };
const old_key = 'a';
const new_key = 'b';
replaceKey(obj, old_key, new_key);
// obj is now { b: 1 }advanced usage
// using "named params"
replaceKey({ obj, old_key, new_key });
// obj is now { b: 1 }