multiline-slash
v2.0.0
Published
Multi-line strings using // as a commentor.
Downloads
60
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