UNPKG

@adikari/config-manager

Version:

Tool to deploy configs to different stores

30 lines (24 loc) 562 B
'use strict'; const get = require('lodash.get'); const makeGetAllParameters = ({ loader }) => ({ parameterNames }) => { return loader.loadMany(parameterNames) .then(parameters => parameters.reduce( (acc, parameter, index) => { const parameterPath = get(parameterNames, index) || ''; const key = parameterPath.split('/').pop(); if (!key) { return acc; } return { ...acc, [key]: parameter } }, {} )) } module.exports = { makeGetAllParameters };