Comparing version 0.3.4 to 1.0.0
@@ -1,5 +0,23 @@ | ||
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.multiline=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.multiline=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
'use strict'; | ||
var stripIndent = _dereq_('strip-indent'); | ||
module.exports = function (str) { | ||
var match = str.match(/^[ \t]*(?=\S)/gm); | ||
if (!match) { | ||
return str; | ||
} | ||
var indent = Math.min.apply(Math, match.map(function (el) { | ||
return el.length; | ||
})); | ||
var re = new RegExp('^[ \\t]{' + indent + '}', 'gm'); | ||
return indent > 0 ? str.replace(re, '') : str; | ||
}; | ||
},{}],2:[function(require,module,exports){ | ||
'use strict'; | ||
var stripIndent = require('strip-indent'); | ||
// start matching after: comment start block => ! or @preserve => optional whitespace => newline | ||
@@ -27,19 +45,3 @@ // stop matching before: last newline => optional whitespace => comment end block | ||
},{"strip-indent":2}],2:[function(_dereq_,module,exports){ | ||
'use strict'; | ||
module.exports = function (str) { | ||
var match = str.match(/^[ \t]*(?=[^\s])/gm); | ||
if (!match) { | ||
return str; | ||
} | ||
var indent = Math.min.apply(Math, match.map(function (el) { return el.length })); | ||
var re = new RegExp('^[ \\t]{' + indent + '}', 'gm'); | ||
return indent > 0 ? str.replace(re, '') : str; | ||
}; | ||
},{}]},{},[1]) | ||
(1) | ||
},{"strip-indent":1}]},{},[2])(2) | ||
}); |
{ | ||
"name": "multiline", | ||
"version": "0.3.4", | ||
"version": "1.0.0", | ||
"description": "Multiline strings in JavaScript", | ||
@@ -36,9 +36,10 @@ "license": "MIT", | ||
"dependencies": { | ||
"strip-indent": "^0.1.0" | ||
"strip-indent": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"browserify": "^5.10.0", | ||
"callsites": "^1.0.0", | ||
"mocha": "*", | ||
"browserify": "^3.0.0", | ||
"callsites": "^0.2.0" | ||
"uglify-js": "^2.4.13" | ||
} | ||
} |
@@ -45,3 +45,3 @@ # multiline [![Build Status](https://travis-ci.org/sindresorhus/multiline.svg?branch=master)](https://travis-ci.org/sindresorhus/multiline) | ||
```bash | ||
```sh | ||
$ npm install --save multiline | ||
@@ -103,11 +103,28 @@ ``` | ||
### String substitution | ||
`console.log()` supports [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data): | ||
```js | ||
var str = 'unicorns'; | ||
console.log(multiline(function(){/* | ||
I love %s | ||
*/}), str); | ||
//=> I love unicorns | ||
``` | ||
## Use cases | ||
A real-world [use case](https://github.com/sindresorhus/pageres/blob/cb85922dec2b962c7b45484023c9ba43a9abf6bd/cli.js#L14-L33) from my `pageres` module. | ||
- [CLI help output](https://github.com/sindresorhus/pageres/blob/cb85922dec2b962c7b45484023c9ba43a9abf6bd/cli.js#L14-L33) | ||
- [Test fixtures](https://twitter.com/TooTallNate/status/465392558000984064) | ||
- [Queries](https://github.com/freethejazz/twitter-to-neo4j/blob/a41b6c2e8480d4b9943640a8aa4b6976f07083bf/cypher/queries.js#L15-L22) - *here an example in Cypher, the query language for Neo4j* | ||
- [CLI welcome message](https://github.com/yeoman/generator-jquery/blob/4b532843663e4b5ce7d433d351e0a78dcf2b1e20/app/index.js#L28-L40) - *here in a Yeoman generator* | ||
Another use case is for query strings. Here's [an example in Cypher](https://github.com/freethejazz/twitter-to-neo4j/blob/master/cypher/queries.js), the query language for Neo4j. | ||
Have one? [Let me know.](https://github.com/sindresorhus/multiline/issues/new) | ||
Have one? Let me know. | ||
## Experiment | ||
@@ -161,13 +178,17 @@ | ||
While it does work fine in the browser, it's mainly intended for use in Node.js. | ||
While it does work fine in the browser, it's mainly intended for use in Node.js. Use at your own risk. | ||
### Install | ||
Download [manually](https://github.com/sindresorhus/multiline/releases) or with a package-manager. | ||
```sh | ||
$ npm install --save multiline | ||
``` | ||
```bash | ||
*(with [Browserify](http://browserify.org))* | ||
```sh | ||
$ bower install --save multiline | ||
``` | ||
```bash | ||
```sh | ||
$ component install sindresorhus/multiline | ||
@@ -192,3 +213,3 @@ ``` | ||
You also need to add `0` after the comment so it's not removed as dead-code. | ||
You also need to add `console.log` after the comment so it's not removed as dead-code. | ||
@@ -205,3 +226,3 @@ The final result would be: | ||
</html> | ||
*/0}); | ||
*/console.log}); | ||
``` | ||
@@ -212,2 +233,2 @@ | ||
[MIT](http://opensource.org/licenses/MIT) © [Sindre Sorhus](http://sindresorhus.com) | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
8030
54
1
229
4
+ Addedget-stdin@4.0.1(transitive)
+ Addedstrip-indent@1.0.1(transitive)
- Removedstrip-indent@0.1.3(transitive)
Updatedstrip-indent@^1.0.0