UNPKG

@alizeait/unflatto

Version:

A tiny (~210B) and fast flattened object expander, unflattener

3 lines (2 loc) 361 B
function t(t){const o=(t+"").charCodeAt(0);return o<48||o>57?{}:[]}exports.unflatto=function(o,n){let r,e,c,u,f,i,p,l=0;for(e in n=n||".",o)for(l=0,i="",c=e.split(n),u=r||t(c[0]),r=r||u;l<c.length&&(f=i||c[l],"prototype"!==f&&"__proto__"!==f&&"constructor"!==f);l++)i=c[l+1],f in u?u=u[f]:(p=i?t(i):o[e],u[f]=p,u=p);return r}; //# sourceMappingURL=index.js.map