🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
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
Version published
Weekly downloads
169
-52.53%
Maintainers
1
Weekly downloads
 
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

tag function

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