Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

babel-plugin-optimize-starts-with

xtuc418MIT1.0.1

Transform startsWith into raw char code tests

optimize, startsWith, babelchar, code, test

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

.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"]
});