{"name":"babel-plugin-transform-numeric-separator","version":"7.0.0-beta.1","description":"Remove numeric separators from Decimal, Binary, Hex and Octal literals","repository":{"type":"git","url":"https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-numeric-separator"},"license":"MIT","main":"lib/index.js","keywords":["babel-plugin"],"dependencies":{"babel-plugin-syntax-numeric-separator":"7.0.0-beta.1"},"devDependencies":{"babel-helper-plugin-test-runner":"7.0.0-beta.1"},"_id":"babel-plugin-transform-numeric-separator@7.0.0-beta.1","_npmVersion":"5.4.1","_nodeVersion":"8.1.4","_npmUser":{"name":"hzoo","email":"hi@henryzoo.com"},"dist":{"integrity":"sha512-l0RovVMTOWQqjaTE6YdtzOWPCokOzka3lQ9SjfIO70y70Oti01eR4jI/nGidJdxWjosr/KsKrII9V0p7OMXFPg==","shasum":"7be7fd047f2e8324ad59ca8cbe2abc8a96b00aa9","tarball":"http://registry-npm.ywwl.com/babel-plugin-transform-numeric-separator/download/babel-plugin-transform-numeric-separator-7.0.0-beta.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCt6wL1q1JELXBny8vgCK6ncYZKXwozdpSnjbAlgKymtwIgf1D8hiL3vjnSSYFvfjcKy3y+vsKU/Rr/DxxBtKarjwU="}],"size":1815,"noattachment":false,"key":"/babel-plugin-transform-numeric-separator/-/babel-plugin-transform-numeric-separator-7.0.0-beta.1.tgz"},"maintainers":[{"name":"hzoo","email":"hi@henryzoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-transform-numeric-separator-7.0.0-beta.1.tgz_1505851800357_0.8525909166783094"},"directories":{},"readme":"# babel-plugin-transform-numeric-separator\n\n> This plugin allows Babel to transform Decimal, Binary, Hex and Octal literals containing Numeric Literal Separator to their non-separated form.\n\n## Example\n\n### Decimal Literals\n\n```js\nlet budget = 1_000_000_000_000;\n\n// What is the value of `budget`? It's 1 trillion!\n// \n// Let's confirm:\nconsole.log(budget === 10 ** 12); // true\n```\n\n### Binary Literals\n\n```js\nlet nibbles = 0b1010_0001_1000_0101;\n\n// Is bit 7 on? It sure is!\n// 0b1010_0001_1000_0101\n//             ^\n//             \n// We can double check: \nconsole.log(!!(nibbles & (1 << 7))); // true\n```\n\n### Hex Literal\n\n```js\n// Messages are sent as 24 bit values, but should be \n// treated as 3 distinct bytes:\nlet message = 0xA0_B0_C0;\n\n// What's the value of the upper most byte? It's A0, or 160.\n// We can confirm that:\nlet a = (message >> 16) & 0xFF; \nconsole.log(a.toString(16), a); // a0, 160\n\n// What's the value of the middle byte? It's B0, or 176.\n// Let's just make sure...\nlet b = (message >> 8) & 0xFF;\nconsole.log(b.toString(16), b); // b0, 176\n\n// What's the value of the lower most byte? It's C0, or 192.\n// Again, let's prove that:\nlet c = message & 0xFF;\nconsole.log(c.toString(16), b); // c0, 192\n```\n\n### Octal Literal\n\n*hand wave emoji*\n\nOctals are great for permissions, but also look better when represented in `0o0000` form. No real benefit with separators here. \n\n## Installation\n\n```sh\nnpm install --save-dev babel-plugin-transform-numeric-separator\n```\n\n## Usage\n\n### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\"transform-numeric-separator\"]\n}\n```\n\n### Via CLI\n\n```sh\nbabel --plugins transform-numeric-separator script.js\n```\n\n### Via Node API\n\n```javascript\nrequire(\"babel-core\").transform(\"code\", {\n  plugins: [\"transform-numeric-separator\"]\n});\n```\n\n## Additional Information \n\nIf you need to further compile ES2015 Decimal, Binary, Hex and Octal number representations to their pre-ES2015 numeric literal form, add the [`\"transform-es2015-literals\"`](http://babeljs.io/docs/plugins/transform-es2015-literals/) plugin:\n\n> `transform-es2015-literals` is already included in [babel-preset-env](https://github.com/babel/babel-preset-env) and babel-preset-es2015.\n\n### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\n```json\n{\n  \"presets\": [\"env\"],\n  \"plugins\": [\"transform-numeric-separator\"]\n}\n{\n  \"plugins\": [\"transform-numeric-separator\", \"transform-es2015-literals\"]\n}\n```\n\n## References\n\n* [Proposal: Numeric Separators](https://github.com/samuelgoto/proposal-numeric-separator)\n","publish_time":1505851800466,"_cnpm_publish_time":1505851800466,"dist-tags":{"latest":"7.0.0-alpha.11","next":"7.0.0-beta.3"}}