Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@doodle/vault / mapData.js
Size: Mime:
/**
 *
 * @param {Object} mapping A mapping to use for reading secrets accessed by the vault data key
 * @param {Object} dest A destination object, by default `{}`
 * @returns {Object} the dest object assigned with values from secrets according to the mapping
 * @example const { myKey } = mapSecrets({ secretKey: 'myKey' })(secrets);
 */
const mapData = (mapping, dest = {}) => ({
  data
}) => Object.keys(data).reduce((result, key) => Object.assign(result, {
  [mapping[key]]: data[key]
}), dest);

module.exports = mapData;