Socket
Socket
Sign inDemoInstall

detect-indent

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detect-indent - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

license

4

package.json
{
"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)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc