{"name":"constantify","description":"Transform your source to inline const values","version":"0.0.0","main":"index.js","browser":"index.js","dependencies":{"static-eval":"0.0.0","through":"~2.3.4","esprima":"~1.0.4","astw":"0.0.0","escodegen":"0.0.27"},"devDependencies":{},"scripts":{},"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"http://github.com/hughsk"},"license":"MIT","repository":{"type":"git","url":"git://github.com/hughsk/constantify"},"bugs":{"url":"https://github.com/hughsk/constantify/issues"},"keywords":["browserify","constant","replace","transform","source","inline"],"readme":"# constantify [![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) #\n\nA [browserify](http://browserify.org) transform (and standalone function)\nthat inlines `const` values into your code. Like\n[envify](http://github.com/hughsk/envify), this comes in handy for things\nsuch as conditional compilation and as such works well with\n[uglifyify](http://github.com/hughsk/uglifyify).\n\n## Usage ##\n\n[![constantify](https://nodei.co/npm/constantify.png?mini=true)](https://nodei.co/npm/constantify)\n\nconstantify will pick up `const` definitions at the top of your module, i.e.\noutside of any closures, and replace their references with their actual values.\nNote that this only works with strings and numbers.\n\nFor example, the following code:\n\n``` javascript\nconst generate = require('./generate')\nconst SIZE = 64\nconst SIZE_SQUARED = 64*64\n\nvar array = new Float32Array(SIZE_SQUARED)\nvar n = 0\n\nfor (var x = 0; x < SIZE; x += 1)\nfor (var y = 0; y < SIZE; y += 1) {\n  array[n++] = generate(x, y)\n}\n```\n\nWill be transformed to become this:\n\n``` javascript\nconst generate = require('./generate')\n\nvar array = new Float32Array(4096)\nvar n = 0\n\nfor (var x = 0; x < 64; x += 1)\nfor (var y = 0; y < 64; y += 1) {\n  array[n++] = generate(x, y)\n}\n```\n\nYou can use constantify the same you would as any other browserify transform:\n\n``` bash\nbrowserify -t constantify\n```\n\nAnd to use it from another module, just pass it your source as a string to the\n`fromString` method, like so:\n\n``` javascript\nvar constantify = require('constantify')\nvar fs = require('fs')\n\nvar file = fs.readFileSync(__dirname + '/index.js', 'utf8')\nvar transformed = constantify.fromString(file)\n\nconsole.log(transformed)\n```\n\n## License ##\n\nMIT. See [LICENSE.md](http://github.com/hughsk/constantify/blob/master/LICENSE.md) for details.\n","readmeFilename":"README.md","_id":"constantify@0.0.0","dist":{"shasum":"aff7f677e30a8c2c660c99bacf617778b799e1c9","tarball":"https://registry.npmjs.org/constantify/-/constantify-0.0.0.tgz","integrity":"sha512-EXhOh3qO/zSQ52h85H24tRmDiFTKRds2xrmxWspXGE61LBccLntqiqLwktO8vj4jvNxWAQu7mkt+5o0klTz+dg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICU/iHvUc8/zUCrkLI02Bb2QM5Z5O1uWFZRD+tPuH3jyAiEAl9Ri8mXutHga7pmLoneoKMjpJrUmxSX39sOg0d+4SjA="}]},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"hughsk","email":"hughskennedy@gmail.com"},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}]}