1.1.0 • Published 5 years ago
babel-plugin-starts-with-ends-with v1.1.0
babel-plugin-starts-with-ends-with
Replaces
startsWithandendsWithwith es5 compatible code.
Example
In
'foobar'.startsWith('foo');
'foobar'.endsWith('bar');Out
'foobar'.indexOf('foo')===0;
'foobar'.slice(-'bar'.length)==='bar';Installation
Using npm:
npm install --save-dev babel-plugin-starts-with-ends-withor using yarn:
yarn add babel-plugin-starts-with-ends-with --devUsage
Via .babelrc (Recommended)
.babelrc
{
"plugins": ["starts-with-ends-with"]
}Via CLI
$ babel --plugins starts-with-ends-with script.jsVia Node API
require("babel-core").transform("code", {
plugins: ["starts-with-ends-with"]
});