Socket
Socket
Sign inDemoInstall

babel-plugin-transform-string-join

Package Overview
Dependencies
50
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-plugin-transform-string-join

Babel plugin that join strings and template strings in compilation when possible


Version published
Weekly downloads
6
increased by50%
Maintainers
1
Install size
3.78 MB
Created
Weekly downloads
 

Readme

Source

babel-plugin-transform-string-join

Build Status

Babel plugin that will join strings and template strings in compilation time whenever it's possible.

Examples

Array.proptotype.join

You can use Array.proptotype.join to join list of strings and template strings together.

In

const className = 'container';
const html = [
  `<div class=${className}>`,
    '<span>Hello World</span>',
  '</div>',
].join('');

Out

const html = `<div class=${className}><span>Hello World</span></div>`;

String addition

Also, you can use + to simply concat strings and template strings together.

In

const className = 'container';
const html =
  `<div class=${className}>` +
    '<span>Hello World</span>' +
  '</div>';

Out

const html = `<div class=${className}><span>Hello World</span></div>`;

Installation

$ npm install babel-plugin-transform-string-join

Usage

.babelrc

{
  "plugins": ["transform-string-join"]
}

Via CLI

$ babel --plugins transform-string-join script.js

Via Node API

require('babel-core').transform('code', {
  plugins: ['transform-string-join']
});

License

MIT

Keywords

FAQs

Last updated on 03 Dec 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc