babel-plugin-starts-with-ends-with

1.1.0 • Public • Published

babel-plugin-starts-with-ends-with

Replaces startsWith and endsWith with 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-with

or using yarn:

yarn add babel-plugin-starts-with-ends-with --dev

Usage

Via .babelrc (Recommended)

.babelrc

{
  "plugins": ["starts-with-ends-with"]
}

Via CLI

$ babel --plugins starts-with-ends-with script.js

Via Node API

require("babel-core").transform("code", {
  plugins: ["starts-with-ends-with"]
});

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.0
    155
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.0
    155
  • 1.0.3
    0
  • 1.0.2
    1
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i babel-plugin-starts-with-ends-with

Weekly Downloads

156

Version

1.1.0

License

MIT

Unpacked Size

4.05 kB

Total Files

4

Last publish

Collaborators

  • mothgears