UNPKG

@sugarcube/plugin-sql

Version:

Import and export Sugarcube data and queries from and to SQL databases.

18 lines (13 loc) 484 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.flattenObj = void 0; var _fp = require("lodash/fp"); const flattenObj = obj => { const iter = (o, prefix) => [].concat(...Object.keys(o).map(k => (0, _fp.isPlainObject)(o[k]) ? iter(o[k], `${prefix}${prefix === "" ? "" : "."}${k}`) : { [`${prefix}${prefix === "" ? "" : "."}${k}`]: o[k] })); return Object.assign({}, ...[].concat(iter(obj, ""))); }; exports.flattenObj = flattenObj;