babel-plugin-optimize-starts-with
v1.0.1
Published
Transform startsWith into raw char code tests
Downloads
109
Maintainers
Readme
babel-plugin-optimize-starts-with
Transform startsWith into raw char code tests
Example
In
if ('test'.startsWith('te')) {
// true
}
Out
if ('test'.charCodeAt(0) === 116&& 'test'.charCodeAt(1) === 101) {
// true
}
Installation
npm install --save-dev babel-plugin-babel-plugin-optimize-starts-with
Usage
Via .babelrc
(Recommended)
.babelrc
{
"plugins": ["babel-plugin-optimize-starts-with"]
}
Via CLI
babel --plugins babel-plugin-optimize-starts-with script.js
Via Node API
require("babel-core").transform("code", {
plugins: ["babel-plugin-optimize-starts-with"]
});