Comparing version 1.0.0 to 1.1.0
{ | ||
"name": "doc-chomp", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Doc Chomp chomps on your document literals", | ||
"main": "index.js", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"prepublish": "babel src --out-dir lib --source-maps inline --ignore \"**/*.spec.js\"", | ||
"test": "jest", | ||
"lint": "eslint ." | ||
"lint": "eslint src", | ||
"lint-and-fixup": "eslint --fix src" | ||
}, | ||
@@ -13,8 +15,20 @@ "author": "Jessica Stokes <hello@jessicastokes.net>", | ||
"devDependencies": { | ||
"babel-cli": "^6.16.0", | ||
"babel-eslint": "^7.0.0", | ||
"babel-jest": "^16.0.0", | ||
"babel-preset-es2015": "^6.16.0", | ||
"eslint": "^3.8.1", | ||
"jest": "^16.0.1" | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"es2015" | ||
] | ||
}, | ||
"jest": { | ||
"collectCoverage": true | ||
}, | ||
"dependencies": { | ||
"literal-toast": "^1.0.0" | ||
} | ||
} |
# 🍴 Doc Chomp | ||
[![npm](https://img.shields.io/npm/v/doc-chomp.svg?maxAge=2592000)](https://www.npmjs.com/package/doc-chomp) ![doc-chomp](https://img.shields.io/npm/l/doc-chomp.svg?maxAge=2592000) [![Build Status](https://travis-ci.org/ticky/doc-chomp.svg?branch=master)](https://travis-ci.org/ticky/doc-chomp) [![codecov](https://codecov.io/gh/ticky/doc-chomp/branch/master/graph/badge.svg)](https://codecov.io/gh/ticky/doc-chomp) | ||
Doc Chomp chomps on your document literals | ||
@@ -9,2 +11,6 @@ | ||
### Automatic | ||
The simplest way to use Doc Chomp is to tag a string! | ||
```javascript | ||
@@ -38,4 +44,53 @@ const DocChomp = require('doc-chomp'); | ||
In this example, `chompedString` will have two space characters trimmed from each line. | ||
In this example, `chompedString` will have two space characters trimmed from each line, and the other one will have six removed from each line. | ||
No text should be added on the same line as DocChomp, as if text was accepted here, Doc Chomp couldn't make a good choice about spacing! | ||
With this usage, the first blank line (adjacent to `DocChomp`) is removed, and no text may be added on that line as DocChomp. If text was accepted here, Doc Chomp couldn't make a good choice about spacing! If you need to put text on that line, you can use the manual modes below! | ||
### Manual | ||
In both of these modes, note that if the line `DocChomp` is on is blank, it will be omitted from the output, and line numbers begin at the next line. | ||
#### Indentation line | ||
If passed a number, Doc Chomp will detect the indentation from that line of the input. | ||
```javascript | ||
function mcGuffin() { | ||
if (this.glazed) { | ||
return chompedString === DocChomp(2)`This string will have six space characters removed from the start of each line | ||
* Because this line is defined as line 2, and used for indentation detection | ||
* 👌🏼 | ||
`; | ||
} else { | ||
return chompedString === DocChomp(2)` | ||
This is the "first" line (line 0), according to Doc Chomp, because the above line is blank. | ||
* Which means this is line 2, and used for indentation detection | ||
* No problem! 👌🏼 | ||
`; | ||
} | ||
} | ||
``` | ||
#### Indentation string | ||
If passed a string, Doc Chomp will remove exactly that indentation from each line. | ||
```javascript | ||
function mcGuffin() { | ||
if (this.glazed) { | ||
return chompedString === DocChomp(' ')`This string will have six space characters removed from the start of each line | ||
* Extra indentation is supported just fine | ||
* No problem! 👌🏼 | ||
`; | ||
} else { | ||
return chompedString === DocChomp('\t\t\t')`This string will have three tab characters removed from the start of each line | ||
* Extra indentation is supported just fine | ||
* No problem! 👌🏼 | ||
`; | ||
} | ||
} | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
179578
20
544
95
1
6
1
+ Addedliteral-toast@^1.0.0
+ Addedliteral-toast@1.0.0(transitive)