Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

single-line-string

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

single-line-string

Converts multiline ES6 template strings to a single line & removes extra whitespace.

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Single Line String

Simple tag function that converts a multiline ES6 template literal to a single line string, removing extra whitespace. Requires a javascript environment that supports es6 template literals (eg: Node >= 4.7.0).

Usage

ES6

import sls from 'single-line-string';

var name = 'June';
const hello = sls`
  Hey,
        hello,
  how
    are
              you
  ${name}?
`

console.log(hello); // outputs: "Hey, hello, how are you June?"

or via Common JS

var sls = require('single-line-string');
var name = 'June';
var hello = sls`
  Hey,
        hello,
  how
    are
              you
  ${name}?
`;

console.log(hello); // outputs: "Hey, hello, how are you June?"

Install

npm install single-line-string

Build

npm install && npm run build

Test

npm run test

Credits

code credit: https://muffinresearch.co.uk/removing-leading-whitespace-in-es6-template-strings/

Keywords

FAQs

Package last updated on 28 Apr 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc