detect-indent
Advanced tools
Comparing version 3.0.0 to 3.0.1
{ | ||
"name": "detect-indent", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Detect the indentation of code", | ||
@@ -41,3 +41,3 @@ "license": "MIT", | ||
"dependencies": { | ||
"get-stdin": "^3.0.0", | ||
"get-stdin": "^4.0.1", | ||
"minimist": "^1.1.0", | ||
@@ -44,0 +44,0 @@ "repeating": "^1.1.0" |
@@ -79,10 +79,43 @@ # detect-indent [![Build Status](https://travis-ci.org/sindresorhus/detect-indent.svg?branch=master)](https://travis-ci.org/sindresorhus/detect-indent) | ||
Look for the most common difference between two consecutive non-empty | ||
lines. | ||
The current algorithm looks for the most common difference between two consecutive non-empty lines. | ||
In the following example, even if the 4-space indentation is used 3 times whereas the 2-space one is used 2 times, it is detected as less used because there were only 2 differences with this value instead of 4 for the 2-space indentation: | ||
```css | ||
html { | ||
box-sizing: border-box; | ||
} | ||
body { | ||
background: grey; | ||
} | ||
p { | ||
line-height: 1.3em; | ||
margin-top: 1em; | ||
text-indent: 2em; | ||
} | ||
``` | ||
[Source](https://medium.com/@heatherarthur/detecting-code-indentation-eff3ed0fb56b#3918). | ||
Furthermore, if there are more than one most used difference, the indentation with the most lines is selected. | ||
In the following example, the indentation is detected as 4-spaces: | ||
```css | ||
body { | ||
background: grey; | ||
} | ||
p { | ||
line-height: 1.3em; | ||
margin-top: 1em; | ||
text-indent: 2em; | ||
} | ||
``` | ||
## License | ||
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
7538
5
121
+ Addedget-stdin@4.0.1(transitive)
- Removedget-stdin@3.0.2(transitive)
Updatedget-stdin@^4.0.1