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

Package detail

multiline-slash

amireh50MIT2.0.0

Multi-line strings using // as a commentor.

multiline, comment

readme

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