UNPKG

moredots

Version:

Recursively converts objects to dot notation.

16 lines (12 loc) 326 B
"use strict"; const isPlainObject = require("lodash.isplainobject"); module.exports = function moredots(src, dst = {}, prefix = "") { for (const key in src) { if (isPlainObject(src[key])) { moredots(src[key], dst, prefix + key + "."); } else { dst[prefix + key] = src[key]; } } return dst; };