{"_id":"squarify","_rev":"7-207685b0287efa2d2bd81d5f9e2b03cc","name":"squarify","description":"TypeScript/JavaScript implementation of Bruls et al.'s squarified treemap algorithm","dist-tags":{"latest":"1.1.0"},"versions":{"0.1.0":{"name":"squarify","version":"0.1.0","description":"TypeScript/JavaScript implementation of Bruls et al.'s squarified treemap algorithm","keywords":["treemap","squarify","typescript"],"license":"MIT","author":{"name":"Huy Nguyen","email":"huy@huy-nguyen.com","url":"https://www.huy-nguyen.com/"},"files":["dist","lib","es"],"main":"lib/index.js","esnext":"es/index.js","repository":{"type":"git","url":"git+https://github.com/huy-nguyen/squarify.git"},"scripts":{"start":"nps","build":"nps build","test":"nps test","commitmsg":"nps commitmsg"},"types":"./lib/index.d.ts","devDependencies":{"@types/lodash":"4.14.65","babel-core":"6.24.1","babel-preset-env":"1.5.1","commitizen":"2.9.6","cz-conventional-changelog-customizable":"1.0.1","husky":"0.13.4","jest":"20.0.4","ts-jest":"20.0.5","tslib":"1.7.1","typescript":"2.3.4","uglify-js":"3.0.15","validate-commit-msg":"2.12.1"},"dependencies":{"lodash":"4.17.4"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog-customizable"}},"gitHead":"c409049f6d009103e422c8e0b3ab1ce77343a74b","bugs":{"url":"https://github.com/huy-nguyen/squarify/issues"},"homepage":"https://github.com/huy-nguyen/squarify#readme","_id":"squarify@0.1.0","_shasum":"9741b24fadc062255922f04e7c06d0f360d297db","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.9.0","_npmUser":{"name":"huy-nguyen","email":"huy@huy-nguyen.com"},"dist":{"shasum":"9741b24fadc062255922f04e7c06d0f360d297db","tarball":"https://registry.npmjs.org/squarify/-/squarify-0.1.0.tgz","integrity":"sha512-R1W7srtyBRP54LXUgXnuU+ubdtd31wQGqeUQXTbQqF7LOPrLar7i7jxXjocDrXAuTKBgAFQu9ZCY47aWCj0NYg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC/2hKuLda+7xhd887AOtX6rDB+duPWl8aQol4MZIRkbQIgc23MGvz+paM4K6/iTAY1SZM9GiwmrIpef53zXOfPvh0="}]},"maintainers":[{"name":"huy-nguyen","email":"huy@huy-nguyen.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/squarify-0.1.0.tgz_1496432466701_0.6796548906713724"},"directories":{}},"0.1.1":{"name":"squarify","version":"0.1.1","description":"TypeScript/JavaScript implementation of Bruls et al.'s squarified treemap algorithm","keywords":["squarify","squarified","treemap","tree","map","typescript"],"license":"MIT","author":{"name":"Huy Nguyen","email":"huy@huy-nguyen.com","url":"https://www.huy-nguyen.com/"},"files":["dist","lib","es"],"main":"lib/index.js","esnext":"es/index.js","repository":{"type":"git","url":"git+https://github.com/huy-nguyen/squarify.git"},"scripts":{"start":"nps","build":"nps build","test":"nps test","commitmsg":"nps commitmsg"},"types":"./lib/index.d.ts","devDependencies":{"@types/lodash":"4.14.65","babel-core":"6.24.1","babel-preset-env":"1.5.1","commitizen":"2.9.6","cz-conventional-changelog-customizable":"1.0.1","husky":"0.13.4","jest":"20.0.4","ts-jest":"20.0.5","tslib":"1.7.1","typescript":"2.3.4","uglify-js":"3.0.15","validate-commit-msg":"2.12.1"},"dependencies":{"lodash":"4.17.4"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog-customizable"}},"gitHead":"8149c6f1381bae3c917e2f00f6fc6caaa346622e","bugs":{"url":"https://github.com/huy-nguyen/squarify/issues"},"homepage":"https://github.com/huy-nguyen/squarify#readme","_id":"squarify@0.1.1","_shasum":"2ac5c33ea7e108a71895bbd9aee41f8b1fc1efb3","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.9.0","_npmUser":{"name":"huy-nguyen","email":"huy@huy-nguyen.com"},"dist":{"shasum":"2ac5c33ea7e108a71895bbd9aee41f8b1fc1efb3","tarball":"https://registry.npmjs.org/squarify/-/squarify-0.1.1.tgz","integrity":"sha512-a910A6bl6WNYkL6yGKO484QrxUHhv4Tz7vbqDYFHjg9aZwsMyNyiTWA/MC0UlC5IK57Hl1Uf78Wfsnf8TQMZyg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC4HZbdksvikKek6TItWIxbVP1KNEsLa5jm5ROnkbotawIhAMRpTfBW4vt/IM23FJYqgzBozxEfNJHIAQhd0lHSM0zG"}]},"maintainers":[{"name":"huy-nguyen","email":"huy@huy-nguyen.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/squarify-0.1.1.tgz_1496523273590_0.7245072908699512"},"directories":{}},"1.0.0":{"name":"squarify","version":"1.0.0","description":"TypeScript/JavaScript implementation of Bruls et al.'s squarified treemap algorithm","keywords":["squarify","squarified","treemap","tree","map","typescript"],"license":"MIT","author":{"name":"Huy Nguyen","email":"huy@huy-nguyen.com","url":"https://www.huy-nguyen.com/"},"files":["dist","lib","es"],"main":"lib/index.js","esnext":"es/index.js","repository":{"type":"git","url":"git+https://github.com/huy-nguyen/squarify.git"},"scripts":{"start":"nps","build":"nps build","test":"nps test","commitmsg":"nps commitmsg"},"types":"./lib/index.d.ts","devDependencies":{"babel-core":"6.24.1","babel-preset-env":"1.5.1","commitizen":"2.9.6","cz-conventional-changelog-customizable":"1.0.1","husky":"0.13.4","jest":"20.0.4","ts-jest":"20.0.5","tslib":"1.7.1","typescript":"2.3.4","uglify-js":"3.0.15","validate-commit-msg":"2.12.1"},"dependencies":{},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog-customizable"}},"gitHead":"d7074c2c91cfceeb9a91bd995a7f92a1e6702886","bugs":{"url":"https://github.com/huy-nguyen/squarify/issues"},"homepage":"https://github.com/huy-nguyen/squarify#readme","_id":"squarify@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.1","_npmUser":{"name":"huy-nguyen","email":"huy@huy-nguyen.com"},"dist":{"integrity":"sha512-QnJlanDEOImhYA0jXeeCO7EI2zFSNAFJqQ4vlBFkIuPf1BCG2zzK0x8IGavlygErSYm69Uebt61Bg0nGEDqyyQ==","shasum":"95809e580fca44d7a49f8d708184d5a142f8f26a","tarball":"https://registry.npmjs.org/squarify/-/squarify-1.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH08LBqezh7/5mRiTws/dlOKF+HFyeDWCwlq15V33dBHAiEAkyJVtlDttrUgw9lmWJeS3m685l7ZEYS11E1H4jO6YxQ="}]},"maintainers":[{"name":"huy-nguyen","email":"huy@huy-nguyen.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/squarify-1.0.0.tgz_1517424500872_0.19377985526807606"},"directories":{}},"1.0.1":{"name":"squarify","version":"1.0.1","description":"TypeScript/JavaScript implementation of Bruls et al.'s squarified treemap algorithm","keywords":["squarify","squarified","treemap","tree","map","typescript"],"license":"MIT","author":{"name":"Huy Nguyen","email":"huy@huy-nguyen.com","url":"https://www.huy-nguyen.com/"},"files":["dist","lib","es"],"main":"lib/index.js","esnext":"es/index.js","repository":{"type":"git","url":"git+https://github.com/huy-nguyen/squarify.git"},"scripts":{"test":"jest --coverage --verbose","test:ci":"jest --ci --runInBand --coverage --verbose --testResultsProcessor=\"jest-junit\"","commitmsg":"validate-commit-msg","commit":"git-cz","clean:lib":"rimraf lib","clean:es":"rimraf es","clean:dist":"rimraf dist","clean":"npm run clean:lib && npm run clean:es && npm run clean:dist","build:lib":"npm run clean:lib && rollup -c -o lib/index.js -f cjs --environment declaration","build:es":"npm run clean:es && rollup -c -o es/index.js -f es","build:dist":"npm run clean:dist && rollup -c -o dist/index.js -f umd --name squarify --environment minify","build":"npm run build:lib && npm run build:dist && npm run build:es","tslint":"tslint --project tsconfig.json --config tslint.json","tslint:fix":"tslint --project tsconfig.json --config tslint.json --fix","eslint":"eslint .","eslint:fix":"eslint . --fix","lint":"npm run eslint && npm run tslint","validate":"npm run test && npm run lint && npm run build","codecov":"codecov","publish":"semantic-release"},"types":"./lib/index.d.ts","devDependencies":{"@cid-harvard/eslint-config":"0.1.2","@cid-harvard/tslint-config":"0.3.0","babel-core":"6.24.1","babel-eslint":"8.2.3","babel-preset-env":"1.5.1","codecov":"3.0.1","commitizen":"2.9.6","cz-conventional-changelog-customizable":"1.0.1","eslint":"4.19.1","eslint-plugin-jest":"21.15.1","eslint-plugin-react":"7.7.0","d3-random":"1.1.0","husky":"0.13.4","jest":"20.0.4","jest-junit":"3.7.0","rollup":"0.58.2","rollup-plugin-typescript2":"0.13.0","rollup-plugin-uglify":"3.0.0","semantic-release":"15.4.0","seedrandom":"2.4.3","ts-jest":"20.0.5","tslib":"1.7.1","tslint":"5.10.0","typescript":"2.8.3","uglify-js":"3.0.15","validate-commit-msg":"2.12.1"},"dependencies":{},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog-customizable"}},"gitHead":"a2c35e365866ce0bbb723e52bea046728c69d57a","bugs":{"url":"https://github.com/huy-nguyen/squarify/issues"},"homepage":"https://github.com/huy-nguyen/squarify#readme","_id":"squarify@1.0.1","_npmVersion":"5.6.0","_nodeVersion":"9.11.1","_npmUser":{"name":"huy-nguyen","email":"me@huynguyen.io"},"dist":{"integrity":"sha512-RC7j8ErUIA0KGYKz0t+nTT/HGRKkeKogO088uuqzg/cqGGTkbYcCWNb/4hHHDIc/knc/xbpC/GRwcBfCCqSzqw==","shasum":"aa7d30897152acf519ca8e296efea775bbfe866c","tarball":"https://registry.npmjs.org/squarify/-/squarify-1.0.1.tgz","fileCount":9,"unpackedSize":29556,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa8gMgCRA9TVsSAnZWagAAOwkQAISL8OkfU70jG7ZtMiSk\nMI9vd/yO9RW4tHYn8daOdBpGsz+sE3vkWaMKate0vGA2Iw4ulYBFow6xRL1w\nkE4GIogZvNeeiqQ8RtxCO6JADcXxd7x4MAbI2kjSa/NoNnqQfIW4wzDZB+ms\nXeGtiEU9KXx5gVHtsoteAJc1Lof6g2TGqpDiw7ucmJvaLmw3chG4xUxWRt0i\ndelH+1J9S56Po2wo36Ik+FFMfH3Sne6OTJh15Yfd4zSNmPhEfCMueVnTvcpR\nwB+QVq4fGTVpejKBePyJQcAHcKWQNBnJjzTmZ8BQql2FXNO3zB0ogVaj0src\nNOa6kICev9qkj5gbIgHt9zMXf811nWm9cT5e2no1W1pdX6/Gz20qvS+47SEd\nMr061sBRzFKtiONHzSBAnYQCvxlryeLFoT5xVvBweZc3Zl1BiXtSasnyW+dz\nQGcLqpq2sBoNEey+0LGVQHtIoFVfX5VtQReQoaFeYS/Zh+lL/Y/qVwYcvydS\nnANorN/aa0qXrm1nAliLRMVa76GggD+MajPLsXvn6Aq6CjuiB+bf8/ZTxnMg\nCm1ZH43wPlcVMLQIQOE8ipqCp0/rJ24IOoFw2A+0wvEKXs3Z6IckCjZFBNdl\nLvDUPvNgRdx4uKUCnOKqzkUYuCoNXvjE/rl8/nyF+nprV2BGfXS8P9ZZZjeM\n/NPZ\r\n=0rbU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCMA+zgEsiHcK2SHQWHzNan2xKhSu4ix5NIFlixvHzNYgIgGQPQnDDLZ1UgoKNHCzgJEl6CM+HUtI83u6RHKmL0Sgk="}]},"maintainers":[{"name":"huy-nguyen","email":"huy@huy-nguyen.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/squarify_1.0.1_1525809951024_0.44775826084139925"},"_hasShrinkwrap":false},"1.1.0":{"name":"squarify","version":"1.1.0","description":"TypeScript/JavaScript implementation of Bruls et al.'s squarified treemap algorithm","keywords":["squarify","squarified","treemap","tree","map","typescript"],"license":"MIT","author":{"name":"Huy Nguyen","email":"huy@huy-nguyen.com","url":"https://www.huy-nguyen.com/"},"main":"lib/index.js","esnext":"es/index.js","repository":{"type":"git","url":"git://github.com/huy-nguyen/squarify.git"},"scripts":{"test":"jest --coverage --no-cache --verbose","test:ci":"jest --ci --runInBand --no-cache --coverage --verbose --reporters=default --reporters=jest-junit","typecheck":"tsc --noEmit","generate:typedef":"tsc --declaration --outDir temp && mkdir -p lib &&  mv temp/index.d.ts lib/index.d.ts && rm -r temp","commit":"git-cz","clean:lib":"rimraf lib","clean:es":"rimraf es","clean:dist":"rimraf dist","clean":"npm run clean:lib && npm run clean:es && npm run clean:dist","build:lib":"npm run clean:lib && rollup -c -o lib/index.js -f cjs --environment declaration","build:es":"npm run clean:es && rollup -c -o es/index.js -f es","build:dist":"npm run clean:dist && rollup -c -o dist/index.js -f umd --name squarify --environment minify --environment es5","build":"npm run clean && npm run typecheck && npm run build:lib && npm run build:dist && npm run build:es && npm run generate:typedef","tslint":"tslint --project tsconfig.json --config tslint.json","tslint:fix":"tslint --project tsconfig.json --config tslint.json --fix","eslint":"eslint .","eslint:fix":"eslint . --fix","lint":"npm run eslint && npm run tslint","validate":"npm run test && npm run lint && npm run build","codecov":"codecov","publish":"semantic-release"},"types":"./lib/index.d.ts","devDependencies":{"@babel/core":"7.2.2","@babel/preset-env":"7.3.1","@babel/preset-typescript":"7.1.0","@cid-harvard/eslint-config":"0.1.2","@cid-harvard/tslint-config":"0.3.0","babel-core":"^7.0.0-bridge.0","babel-eslint":"8.2.6","babel-jest":"23.6.0","babel-preset-env":"1.7.0","codecov":"3.1.0","commitizen":"3.0.5","cz-conventional-changelog-customizable":"1.0.1","d3-random":"1.1.2","eslint":"5.0.0","eslint-plugin-jest":"22.1.3","eslint-plugin-react":"7.12.3","husky":"1.3.1","jest":"23.6.0","jest-junit":"6.0.1","rollup":"1.1.0","rollup-plugin-babel":"4.3.1","rollup-plugin-node-resolve":"4.0.0","rollup-plugin-terser":"4.0.4","seedrandom":"2.4.4","semantic-release":"15.13.3","tslib":"1.9.3","tslint":"5.10.0","typescript":"3.2.2","uglify-js":"3.4.1","validate-commit-msg":"2.14.0"},"dependencies":{},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog-customizable"}},"husky":{"hooks":{"commit-msg":"validate-commit-msg"}},"gitHead":"0f3b0f6f26c880ebf328306f55c5d1fbed0ce7b1","bugs":{"url":"https://github.com/huy-nguyen/squarify/issues"},"homepage":"https://github.com/huy-nguyen/squarify#readme","_id":"squarify@1.1.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.1","_npmUser":{"name":"huy-nguyen","email":"me@huynguyen.io"},"dist":{"integrity":"sha512-0nD8UD4FPOfWHdaVYACbr1SmBF5XQeTbDcRfVs8NHVtueRC0OPo4DN/TJVjAJZ0fLwrgDhEI3XrhUicglD9npw==","shasum":"3eb946f4575bb21f90c4e8f1b65991f2bd4ce4f4","tarball":"https://registry.npmjs.org/squarify/-/squarify-1.1.0.tgz","fileCount":9,"unpackedSize":77850,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcW7qlCRA9TVsSAnZWagAAkDEP/1g33+0KjfeodtgnGvb6\nSZBRI/RR3B4jjWUxUvEHXXZSeqGRETEmBNroGvCzNiEAGrB4vjEtI/GvGIXc\nrg1mdSzlL0LeT+6tocfConex9pR/uI/lqTBTFFu5o/UYe269ih8ZBqBWrqCO\nZmLJltlomdxyTV7Alv720cMUfmEJotjSIrReAGj1aQ3H/jG36+5mcMBUjl/i\nwrCCuDVCMscgjfm8uXmhja/y0WSZ0OlAWMplTXtcvbg9Rw/mlyUD41itS+gA\npAf+n4rFGh+DHBl9rv8TP26+8ivqLn4gEupDQxUR7aRVSLNSlloS5H+MnQgp\nKhAXyVFbC52qoxFC0Z9IlMQmoNoJeHWYCF1w3+qX+xfk1dgUQtUbQpTtlkRo\nCoVWoU0+0VPpgLmWsJcelf9V6Ec+m+nOpQ/zXhZ7UAM3J7YV9jF4hG08YPrg\n+ASuZfttkf80lFW4tjXWR1tGIHHD7UjdAq3ENsB0uZZnSZBFX1Fzs07XwNvL\n10tsVKtxlWwvu7fgEVL09ePyypgd/LhtDjZOmBjX6FMISU8JV97tfaNUh7mk\n7R5vWe9xMb2/gbzWmW4siQwYg4ZJw9LgNFR5peCBbr9Hhc6ZUp0qvdW+uGtm\nG04wRTgGAXksVrRHgy8jDbIhCNWkmP/m/WDsYZT1ypiqN0lSj5fBm8xYG4gv\ny7xc\r\n=nQY9\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC7Qe/gH67sW0TIc7+SonJQe4VJJmZVlEUN3N4+rbJsVQIhAO9le98rT2wkXmDPAbtmBVDKE52bYawHoJEZYnXMPSer"}]},"maintainers":[{"name":"huy-nguyen","email":"huy@huy-nguyen.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/squarify_1.1.0_1549515429265_0.8039012085703363"},"_hasShrinkwrap":false}},"readme":"# Squarify\nThis package is a TypeScript implementation (with no external runtime dependencies) of [Bruls _et al._'s squarified treemap algorithm](https://graphics.ethz.ch/teaching/scivis_common/Literature/squarifiedTreeMaps.pdf).\nThis is a \"battle-tested\" implementation and is currently used to calculate the layout of the trade tree map in the [Atlas of Economic Complexity](http://atlas.cid.harvard.edu/explore/), a data visualizsation tool used by 15,000 unique visitors per month.\n\nUnlike other JavaScript implementations, it is written in clear, readable code and backed up by unit tests ([98% coverage](https://codecov.io/gh/huy-nguyen/squarify)).\n\nAs a strong believer in composable software, I deliberately made this package minimal. It only performs the layout step. You are free to use the output to render whichever way you want.\n\n\n[![npm](https://img.shields.io/npm/v/squarify.svg?style=flat-square)](https://www.npmjs.com/package/squarify)\n[![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest)\n[![codecov](https://codecov.io/gh/huy-nguyen/squarify/branch/master/graph/badge.svg)](https://codecov.io/gh/huy-nguyen/squarify) [![Greenkeeper badge](https://badges.greenkeeper.io/huy-nguyen/squarify.svg)](https://greenkeeper.io/)\n\n## Installation\n\n`npm install --save squarify`\n\n## Usage\n\n### Input\nThe default `export` of this package is a function that expects two parameters:\n- An array of input `data`. It's a recursive data structure where each element has this shape:\n```typescript\ntype Input<Custom> = {\n    value: number;\n    children?: Input<Custom>[];\n} & Custom;\n```\nwhere `Custom` describes the type of any extra data the user wants to attach to each node. This data will be passed through to the result.\n  - `value` is a **strictly positive** (i.e. non-zero) number and must be provided. The displayed area of any node is proportional to its `value`. The sum of the `value` of a node's leaves must equal the `value` of the node itself. At every level of nesting of `data`, all array items must be already sorted in descending `value` order.\n  - `children` is optional and indicates whether a datum is a node (`children` is an array) or a leaf (`children` is `undefined`).\n  - Your data also shouldn't contain the property `normalizedValue` because it is used internally by the package.\n\nSample input data (note that the `name` and `color` fields in the input data, which are user-defined and optional, will be passed through to the result):\n```javascript\n[{\n  name: 'Azura', value: 6, color: 'red',\n}, {\n  name: 'Seth', value: 5, color: '',\n  children: [\n    {\n      name: 'Noam', value: 3, color: 'orange',\n    },\n    {\n      name: 'Enos', value: 2, color: 'yellow',\n    },\n  ]\n}, {\n  name: 'Awan', value: 5, color: '',\n  children: [{\n      name: 'Enoch', value: 5, color: 'green',\n  }]\n}, {\n  name: 'Abel', value: 4, color: 'blue',\n}, {\n  name: 'Cain', value: 1, color: 'indigo',\n}]\n```\n- A rectangle that this algorithm will try to fit the tree map into. It should be specified as an object with this shape:\n```typescript\ninterface Container {\n    x0: number;\n    y0: number;\n    x1: number;\n    y1: number;\n}\n```\nwhere (`x0`, `y0`) and (`x1`, `y1`) are the coordinates of the top-left and bottom-right corners of the rectangle, respectively (`x` increases going rightward and `y` increases going downward on the page). Sample data:\n```js\n{x0: 0, y0: 0, x1: 100, y1: 50};\n```\n\n### Output\nThe output is an array of layout rectangles. Each rectangle has this shape:\n```typescript\ninterface Result {\n  x0: number;\n  y0: number;\n  x1: number;\n  y1: number;\n  value: number,\n  normalizedValue: number\n} & Custom\n```\nwhere\n  - `x0`, `y0`, `x1`, `y1` are the coordinates of the top-left and bottom-right corners of the rectangle.\n  - `normalizedValue` is a value used internally, which you can ignore.\n  - `value` is the same one from the original input data.\n  - Any extra properties in the input are passed through to this rectangle. Also note that the algorithm also flatten the output such that only leaves in the original data will appear in the output.\n\nSample output for the above sample input:\n```javascript\n[\n  {x0: 0, y0: 0, x1: 41.66, y1: 35, name: 'Noam', value: 3, color: 'orange'},\n  {x0: 0, y0: 35, x1: 41.66, y1: 50, name: 'Enos', value: 2, color: 'yellow'},\n  {x0: 41.66, y0: 0, x1: 70.83, y1: 50, name: 'Abel', value: 4, color: 'blue'},\n  {x0: 70.83, y0: 0, x1: 100, y1: 28.57, name: 'Azura', value: 6, color: 'red'},\n  {x0: 70.83, y0: 0, x1: 90.27, y1: 50, name: 'Enoch', value: 5, color: 'green'},\n  {x0: 90.27, y0: 28.57, x1: 100, y1: 50, name: 'Cain', value: 1, color: 'indigo'}\n]\n```\n\n### Sample input\nThis is sample usage in a TypeScript file:\n```typescript\nimport squarify, {\n  Input\n} from 'squarify'\n\ninterface Custom {\n  name: string;\n  color: string;\n}\nconst data: Input<Custom>[] = [{\n  name: 'Azura', value: 6, color: 'red',\n}, {\n  name: 'Seth', value: 5, color: '',\n  children: [\n    {\n      name: 'Noam', value: 3, color: 'orange',\n    },\n    {\n      name: 'Enos', value: 2, color: 'yellow',\n    },\n  ]\n}, {\n  name: 'Awan', value: 5, color: '',\n  children: [{\n      name: 'Enoch', value: 5, color: 'green',\n  }]\n}, {\n  name: 'Abel', value: 4, color: 'blue',\n}, {\n  name: 'Cain', value: 1, color: 'indigo',\n}];\n\nconst container = {x0: 0, y0: 0, x1: 100, y1: 50};\n\nconst output = squarify<Custom>(data, container);\n```\n\nThis is a sample in JavaScript:\n```javascript\nimport squarify from 'squarify'\n// Or `const squarify = require('squarify')` in NodeJS.\n\nconst data = [{\n  name: 'Azura', value: 6, color: 'red',\n}, {\n  name: 'Seth', value: 5, color: '',\n  children: [\n    {\n      name: 'Noam', value: 3, color: 'orange',\n    },\n    {\n      name: 'Enos', value: 2, color: 'yellow',\n    },\n  ]\n}, {\n  name: 'Awan', value: 5, color: '',\n  children: [{\n      name: 'Enoch', value: 5, color: 'green',\n  }]\n}, {\n  name: 'Abel', value: 4, color: 'blue',\n}, {\n  name: 'Cain', value: 1, color: 'indigo',\n}];\n\nconst container = {x0: 0, y0: 0, x1: 100, y1: 50};\n\nconst output = squarify(data, container);\n```\n\n## Contributing\nPlease see the [contributing guide](CONTRIBUTING.md) if you are interested in helping.\n","maintainers":[{"name":"huy-nguyen","email":"huy@huy-nguyen.com"}],"time":{"modified":"2022-06-26T23:20:51.930Z","created":"2017-06-02T19:41:06.857Z","0.1.0":"2017-06-02T19:41:06.857Z","0.1.1":"2017-06-03T20:54:34.491Z","1.0.0":"2018-01-31T18:48:22.279Z","1.0.1":"2018-05-08T20:05:51.112Z","1.1.0":"2019-02-07T04:57:09.402Z"},"homepage":"https://github.com/huy-nguyen/squarify#readme","keywords":["squarify","squarified","treemap","tree","map","typescript"],"repository":{"type":"git","url":"git://github.com/huy-nguyen/squarify.git"},"author":{"name":"Huy Nguyen","email":"huy@huy-nguyen.com","url":"https://www.huy-nguyen.com/"},"bugs":{"url":"https://github.com/huy-nguyen/squarify/issues"},"license":"MIT","readmeFilename":"README.md"}