multiline-slash

2.0.0 • Public • Published

multiline-slash

A JavaScript function that allows you to write multi-line strings.

This is different than multiline in that it allows you to use /* */ inside the string, for things like parsing comments and such.

Example

var multiline = require('multiline-slash');
 
var str = multiline(function() {
  // Hello
  // World!
});
 
console.assert(str === 'Hello\nWorld!');
var multiline = require('multiline-slash');
 
multiline(function() {
  // /**
  //  * Hello World!
  //  */
});
 
console.assert(str === '/**\n Hello World!\n*/');

You can remove padding too:

var multiline = require('multiline-slash');
 
var str = multiline(function() {
        // Hello
}, true);
 
console.assert(str === 'Hello');

Installation

npm install multiline-slash

Changelog

2.0.0

  • Hack to work around istanbul's instrumentation; prefix your // with a ; to make it tick

Readme

Keywords

Package Sidebar

Install

npm i multiline-slash

Weekly Downloads

41

Version

2.0.0

License

MIT

Last publish

Collaborators

  • amireh