UNPKG

@sapphire/utilities

Version:
23 lines (21 loc) 582 B
import { __name } from '../chunk-PAWJFY3S.mjs'; // src/lib/makeObject.ts function makeObject(path, value, obj = {}) { if (path.includes(".")) { const route = path.split("."); const lastKey = route.pop(); let reference = obj; for (const key of route) { if (!reference[key]) reference[key] = {}; reference = reference[key]; } reference[lastKey] = value; } else { obj[path] = value; } return obj; } __name(makeObject, "makeObject"); export { makeObject }; //# sourceMappingURL=makeObject.mjs.map //# sourceMappingURL=makeObject.mjs.map