/*! * obj2indent * * @version 0.0.1 * @license MIT * @author tsuyoshiwada * @url https://github.com/tsuyoshiwada/obj2indent */ !function(e){"use strict";function n(e,n){return Object.prototype.hasOwnProperty.call(e,n)}function t(e,n){for(var t="";1&n&&(t+=e),n>>=1,n;)e+=e;return t}function o(e,i,u){var c,d,f,l=[],a=r.keys,h=a.name,p=a.children,s=e.length;for(d=0;s>d;d++)f=e[d],n(f,h)&&(l.push(t(i,u)+f[h]),n(f,p)&&f[p].length&&(c=o(f[p],i,u+1),c.length>0&&(l=l.concat(c))));return l}function r(e,n){return o(e,n||r.defaultIndent,0).join("\n")}r.defaultIndent=" ",r.keys={name:"name",children:"children"},"object"==typeof module&&"object"==typeof module.exports?module.exports=r:"function"==typeof define&&define.amd?define("obj2indent",r):e.obj2indent=r}(this);