You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
352 B
24 lines
352 B
const iter = (obj, stack) => {
|
|
const key = stack.join('.');
|
|
if (obj === null) {
|
|
return `${key}=null`
|
|
}
|
|
if (typeof obj === "object") {
|
|
return `${key}={}`
|
|
}
|
|
if (typeof obj === "string") {
|
|
return `${key}=${JSON.stringify(obj)}`
|
|
}
|
|
|
|
|
|
return `${key}=${obj}`
|
|
|
|
}
|
|
export const gronify = (obj) => {
|
|
|
|
|
|
|
|
return iter(obj, ["json"])
|
|
|
|
}
|