{"_id":"flatten-vertex-data","_rev":"4213361","name":"flatten-vertex-data","description":"flattens nested vertex data into a typed array","dist-tags":{"latest":"1.0.2"},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"time":{"modified":"2026-03-04T17:07:52.000Z","created":"2015-10-13T14:11:12.578Z","1.0.2":"2018-05-01T19:53:56.455Z","1.0.1":"2018-04-23T13:42:16.109Z","1.0.0":"2015-10-13T14:11:12.578Z"},"users":{},"author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"repository":{"type":"git","url":"git://github.com/glo-js/flatten-vertex-data.git"},"versions":{"1.0.2":{"name":"flatten-vertex-data","version":"1.0.2","description":"flattens nested vertex data into a typed array","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{"dtype":"^2.0.0"},"devDependencies":{"faucet":"0.0.1","standard":"^5.3.1","tape":"^4.9.0"},"scripts":{"test":"standard && node test.js | faucet"},"keywords":["dtype","flat","flatten","pack","array","type","typed","typedarray","vert","vertex","webgl","gl","glsl","shader","buffer"],"repository":{"type":"git","url":"git://github.com/glo-js/flatten-vertex-data.git"},"homepage":"https://github.com/glo-js/flatten-vertex-data","bugs":{"url":"https://github.com/glo-js/flatten-vertex-data/issues"},"gitHead":"710a1346ac5f55fefe05e7eeafabd077653dd074","_id":"flatten-vertex-data@1.0.2","_npmVersion":"5.7.1","_nodeVersion":"8.10.0","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"dist":{"shasum":"889fd60bea506006ca33955ee1105175fb620219","size":2637,"noattachment":false,"key":"/flatten-vertex-data/-/flatten-vertex-data-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/flatten-vertex-data/download/flatten-vertex-data-1.0.2.tgz"},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/flatten-vertex-data_1.0.2_1525204436328_0.2547520668535501"},"_hasShrinkwrap":false,"publish_time":1525204436455,"_cnpm_publish_time":1525204436455,"_cnpmcore_publish_time":"2021-12-16T21:38:50.512Z"},"1.0.1":{"name":"flatten-vertex-data","version":"1.0.1","description":"flattens nested vertex data into a typed array","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{"dtype":"^2.0.0"},"devDependencies":{"faucet":"0.0.1","standard":"^5.3.1","tape":"^4.9.0"},"scripts":{"test":"standard && node test.js | faucet"},"keywords":["dtype","flat","flatten","pack","array","type","typed","typedarray","vert","vertex","webgl","gl","glsl","shader","buffer"],"repository":{"type":"git","url":"git://github.com/glo-js/flatten-vertex-data.git"},"homepage":"https://github.com/glo-js/flatten-vertex-data","bugs":{"url":"https://github.com/glo-js/flatten-vertex-data/issues"},"gitHead":"9394d5edf0beeff5e2def2a469800fd2433e047b","_id":"flatten-vertex-data@1.0.1","_npmVersion":"5.7.1","_nodeVersion":"8.10.0","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"dist":{"shasum":"d81e0925b576a9bc11a6c113ccf06d8347212d62","size":2628,"noattachment":false,"key":"/flatten-vertex-data/-/flatten-vertex-data-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/flatten-vertex-data/download/flatten-vertex-data-1.0.1.tgz"},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/flatten-vertex-data_1.0.1_1524490936053_0.6933920270946323"},"_hasShrinkwrap":false,"publish_time":1524490936109,"_cnpm_publish_time":1524490936109,"_cnpmcore_publish_time":"2021-12-16T21:38:50.905Z"},"1.0.0":{"name":"flatten-vertex-data","version":"1.0.0","description":"flattens nested vertex data into a typed array","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{"array-pack-2d":"^0.1.1","dtype":"^2.0.0","is-typedarray":"^1.0.0"},"devDependencies":{"faucet":"0.0.1","standard":"^5.3.1","tape":"^4.2.1"},"scripts":{"test":"standard && node test.js | faucet"},"keywords":["dtype","flat","flatten","pack","array","type","typed","typedarray","vert","vertex","webgl","gl","glsl","shader","buffer"],"repository":{"type":"git","url":"git://github.com/glo-js/flatten-vertex-data.git"},"homepage":"https://github.com/glo-js/flatten-vertex-data","bugs":{"url":"https://github.com/glo-js/flatten-vertex-data/issues"},"gitHead":"71f842b0fca43e27b9dc9c1d9b20120942d2dfb0","_id":"flatten-vertex-data@1.0.0","_shasum":"d61c94f2a6564f301d6678b7261616af0004708c","_from":".","_npmVersion":"2.14.5","_nodeVersion":"0.12.7","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"dist":{"shasum":"d61c94f2a6564f301d6678b7261616af0004708c","size":2560,"noattachment":false,"key":"/flatten-vertex-data/-/flatten-vertex-data-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/flatten-vertex-data/download/flatten-vertex-data-1.0.0.tgz"},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"directories":{},"publish_time":1444745472578,"_hasShrinkwrap":false,"_cnpm_publish_time":1444745472578,"_cnpmcore_publish_time":"2021-12-16T21:38:51.152Z"}},"readme":"# flatten-vertex-data\n\n[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)\n\nCopies flat or nested array data into the specified typed array, or a new typed array. Intended to be used for WebGL buffers. If the input is nested array data, this guesses the dimensionality based on the length of the first sub-array.\n\n## Install\n\n```sh\nnpm install flatten-vertex-data --save\n```\n\n## Example\n\nAccepts a [dtype string](https://www.npmjs.com/package/dtype) (creating a new array) or an output typed array to re-use. Defaults to creating a new Float32Array.\n\n```js\nvar flatten = require('flatten-vertex-data')\n\nvar positions = [ [x1, y1], [x2, y2], [x3, y3] ]\n\nflatten(positions)\n//=> new Float32Array([ x1, y1, x2, y2, x3, y3 ])\n\nflatten(positions, 'uint16')\n//=> new Uint16Array([ x1, y1, x2, y2, x3, y3 ])\n\n// flatten & copy positions into output\nvar output = new Uint16Array(positions.length * 2)\nflatten(positions, output)\n```\n\n## Usage\n\n[![NPM](https://nodei.co/npm/flatten-vertex-data.png)](https://www.npmjs.com/package/flatten-vertex-data)\n\n#### `output = flatten(data, [output|type], [offset])`\n\nCopies flat or nested arrays into a typed array, where `data` can be:\n\n- a nested array like `[ [ x, y ], [ x, y ] ]`\n- a flat array like `[ x, y, z, x, y, z ]`\n- a typed array like `new Float32Array([ x, y ])`\n\nThe second parameter can be a `type` string for [dtype](https://www.npmjs.com/package/dtype), which creates a new array. Or, it can be an existing typed array to re-use as the `output` destination. It defaults to `'float32'` (a new Float32Array).\n\nReturns the `output` typed array.\n\nThe third parameter, `offset`, can be a number (default 0), the index in the destination array at which to start copying the `data`. If a new array is being created, its capacity will be expanded to fit `dataLength + offset` (i.e. it will have leading zeros).\n\n## License\n\nMIT, see [LICENSE.md](http://github.com/glo-js/flatten-vertex-data/blob/master/LICENSE.md) for details.\n","_attachments":{},"homepage":"https://github.com/glo-js/flatten-vertex-data","bugs":{"url":"https://github.com/glo-js/flatten-vertex-data/issues"},"license":"MIT"}