omnibelt/update-keys.js

  1. const assoc = require('ramda/src/assoc');
  2. const updateKeysWith = require('./update-keys-with');
  3. /**
  4. * Updates the key names for a given object according to the provided map of
  5. * { oldKey: newKey } where `newKey` is a string. Any keys that aren't included
  6. * in the map will be passed through unchanged.
  7. *
  8. * @signature { a: String } -> { a: * } -> { b: * }
  9. *
  10. * @example
  11. * updateKeys({ foo: 'bar' }, { foo: 1 }); // => { bar: 1 }
  12. */
  13. const updateKeys = updateKeysWith(assoc);
  14. module.exports = updateKeys;