Comparing version 0.2.0 to 0.3.0
{ | ||
"name": "multiline", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Multiline strings in JavaScript", | ||
"license": "MIT", | ||
"main": "multiline.js", | ||
"repository": "sindresorhus/multiline", | ||
@@ -17,8 +16,10 @@ "author": { | ||
"scripts": { | ||
"test": "mocha" | ||
"test": "mocha", | ||
"browser": "a=$npm_package_name; browserify -r ./index:$a -s $a index.js -o browser.js" | ||
}, | ||
"files": [ | ||
"multiline.js" | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"browser", | ||
"multiline", | ||
@@ -34,6 +35,10 @@ "multi-line", | ||
], | ||
"dependencies": { | ||
"strip-indent": "^0.1.0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "*", | ||
"browserify": "^3.0.0", | ||
"callsite": "^1.0.0" | ||
} | ||
} |
108
readme.md
@@ -1,2 +0,2 @@ | ||
# multiline [![Build Status](https://travis-ci.org/sindresorhus/multiline.png?branch=master)](https://travis-ci.org/sindresorhus/multiline) | ||
# multiline [![Build Status](https://travis-ci.org/sindresorhus/multiline.svg?branch=master)](https://travis-ci.org/sindresorhus/multiline) | ||
@@ -50,3 +50,3 @@ > Multiline strings in JavaScript | ||
## Example | ||
## Usage | ||
@@ -64,4 +64,2 @@ Everything after the first newline and before the last will be returned as seen below: | ||
*/}); | ||
console.log(str); | ||
``` | ||
@@ -80,29 +78,20 @@ | ||
And a [real-world use-case](https://github.com/sindresorhus/pageres/blob/cb85922dec2b962c7b45484023c9ba43a9abf6bd/cli.js#L14-L33). | ||
### Strip indent | ||
You can use `multiline.stripIndent()` to be able to indent your multiline string without preserving the redundant leading whitespace. | ||
## Browser | ||
```js | ||
var str = multiline.stripIndent(function(){/* | ||
<!doctype html> | ||
<html> | ||
<body> | ||
<h1>❤ unicorns</h1> | ||
</body> | ||
</html> | ||
*/}); | ||
``` | ||
### Compatibility | ||
Which outputs: | ||
- Latest Chrome | ||
- Firefox >=17 | ||
- Safari >=4 | ||
- Opera >=9 | ||
- Internet Explorer >=6 | ||
### Minification | ||
Even though minifiers strip comments by default there are ways to preserve them: | ||
- Uglify: Use `/*@preserve` instead of `/*` and enable the `comments` option | ||
- Closure Compiler: Use `/*@preserve` instead of `/*` | ||
- YUI Compressor: Use `/*!` instead of `/*` | ||
You also need to add `0` after the comment so it's not removed as dead-code. | ||
The final result would be: | ||
```js | ||
var str = multiline(function(){/*!@preserve | ||
``` | ||
<!doctype html> | ||
@@ -114,22 +103,11 @@ <html> | ||
</html> | ||
*/0}); | ||
``` | ||
### Install | ||
## Use cases | ||
Download [manually](https://github.com/sindresorhus/multiline/releases) or with a package-manager. | ||
A real-world [use case](https://github.com/sindresorhus/pageres/blob/cb85922dec2b962c7b45484023c9ba43a9abf6bd/cli.js#L14-L33) from my `pageres` module. | ||
#### [Bower](http://bower.io) | ||
Have one? Let me know. | ||
``` | ||
bower install --save multiline | ||
``` | ||
#### [Component](https://github.com/component/component) | ||
``` | ||
component install sindresorhus/multiline | ||
``` | ||
## Experiment | ||
@@ -181,4 +159,52 @@ | ||
## Browser | ||
While it does work fine in the browser, it's mainly intended for use in Node.js. | ||
### Install | ||
Download [manually](https://github.com/sindresorhus/multiline/releases) or with a package-manager. | ||
```bash | ||
$ bower install --save multiline | ||
``` | ||
```bash | ||
$ component install sindresorhus/multiline | ||
``` | ||
### Compatibility | ||
- Latest Chrome | ||
- Firefox >=17 | ||
- Safari >=4 | ||
- Opera >=9 | ||
- Internet Explorer >=6 | ||
### Minification | ||
Even though minifiers strip comments by default there are ways to preserve them: | ||
- Uglify: Use `/*@preserve` instead of `/*` and enable the `comments` option | ||
- Closure Compiler: Use `/*@preserve` instead of `/*` | ||
- YUI Compressor: Use `/*!` instead of `/*` | ||
You also need to add `0` after the comment so it's not removed as dead-code. | ||
The final result would be: | ||
```js | ||
var str = multiline(function(){/*!@preserve | ||
<!doctype html> | ||
<html> | ||
<body> | ||
<h1>❤ unicorns</h1> | ||
</body> | ||
</html> | ||
*/0}); | ||
``` | ||
## License | ||
[MIT](http://opensource.org/licenses/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
5392
206
1
3
18
+ Addedstrip-indent@^0.1.0
+ Addedstrip-indent@0.1.3(transitive)