import { forEach } from 'lodash';
/**
 * 替换json的key值
 * @param {object} data json数据
 * @param {object} map 用value值替换key值，比如：{ children: 'categories' }
 */

export function replaceKeys(data, map) {
  var dataString = JSON.stringify(data);
  forEach(map, function (value, key) {
    dataString = dataString.replace(RegExp("\"".concat(key, "\":"), 'g'), "\"".concat(value, "\":"));
  });
  return JSON.parse(dataString);
}
export default {
  replaceKeys: replaceKeys
};
//# sourceMappingURL=util.js.map
