JSPM

replace-key

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4804
  • Score
    100M100P100Q125304F
  • License CC0-1.0

Replace the Key in an Object

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-key

usage

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 }