{"_id":"detect-indent","_rev":"4181512","name":"detect-indent","description":"Detect the indentation of code","dist-tags":{"latest":"7.0.2"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2026-03-01T21:51:52.000Z","created":"2013-08-11T00:28:31.046Z","7.0.2":"2025-09-16T01:53:36.911Z","7.0.1":"2022-09-11T12:40:07.617Z","7.0.0":"2021-08-08T22:33:14.482Z","6.1.0":"2021-05-28T06:44:53.545Z","6.0.0":"2019-04-30T12:43:08.146Z","5.0.0":"2016-10-20T19:48:14.523Z","4.0.0":"2015-09-07T09:38:01.807Z","3.0.1":"2015-02-16T17:31:25.306Z","3.0.0":"2014-11-23T03:45:43.877Z","2.0.0":"2014-10-26T03:05:04.210Z","1.0.1":"2014-10-03T22:36:45.242Z","1.0.0":"2014-09-11T11:02:05.021Z","0.2.0":"2014-06-16T16:40:58.661Z","0.1.4":"2014-04-29T19:20:03.852Z","0.1.3":"2013-09-25T22:03:28.005Z","0.1.2":"2013-08-30T08:34:24.581Z","0.1.1":"2013-08-13T17:54:38.934Z","0.1.0":"2013-08-11T00:28:31.046Z"},"users":{"passy":true,"sbruchmann":true,"johnnyscript":true,"demian_dark":true,"rocket0191":true,"liunian":true},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/detect-indent.git"},"versions":{"7.0.2":{"name":"detect-indent","version":"7.0.2","description":"Detect the indentation of code","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/detect-indent.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","types":"./index.d.ts","sideEffects":false,"engines":{"node":">=12.20"},"scripts":{"test":"xo && ava && tsd"},"keywords":["indent","indentation","detect","infer","identify","code","string","text","source","space","tab"],"devDependencies":{"ava":"^3.15.0","tsd":"^0.17.0","xo":"^0.44.0"},"xo":{"ignores":["fixture"]},"_id":"detect-indent@7.0.2","gitHead":"101daf9d541f3e73a267476cbb1e71b64e264e0d","bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"homepage":"https://github.com/sindresorhus/detect-indent#readme","_nodeVersion":"20.19.5","_npmVersion":"10.9.2","dist":{"shasum":"16c516bf75d4b2f759f68214554996d467c8d648","size":4015,"noattachment":false,"key":"/detect-indent/-/detect-indent-7.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-indent/download/detect-indent-7.0.2.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/detect-indent_7.0.2_1757987616737_0.8453981111325706"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2025-09-16T01:53:36.911Z","publish_time":1757987616911,"_source_registry_name":"default","_cnpm_publish_time":1757987616911},"7.0.1":{"name":"detect-indent","version":"7.0.1","description":"Detect the indentation of code","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/detect-indent.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":">=12.20"},"scripts":{"test":"xo && ava && tsd"},"keywords":["indent","indentation","detect","infer","identify","code","string","text","source","space","tab"],"devDependencies":{"ava":"^3.15.0","tsd":"^0.17.0","typescript":"^4.3.5","xo":"^0.44.0"},"xo":{"ignores":["fixture"]},"types":"./index.d.ts","gitHead":"ffbb83160f63448be6aa86fef6ff76ad91cdd917","bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"homepage":"https://github.com/sindresorhus/detect-indent#readme","_id":"detect-indent@7.0.1","_nodeVersion":"14.19.3","_npmVersion":"8.3.2","dist":{"shasum":"cbb060a12842b9c4d333f1cac4aa4da1bb66bc25","size":4058,"noattachment":false,"key":"/detect-indent/-/detect-indent-7.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-indent/download/detect-indent-7.0.1.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/detect-indent_7.0.1_1662900007412_0.5343960759105832"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-09-11T12:40:11.963Z","publish_time":1662900007617,"_cnpm_publish_time":1662900007617},"7.0.0":{"name":"detect-indent","version":"7.0.0","description":"Detect the indentation of code","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/detect-indent.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":">=12.20"},"scripts":{"test":"xo && ava && tsd"},"keywords":["indent","indentation","detect","infer","identify","code","string","text","source","space","tab"],"devDependencies":{"ava":"^3.15.0","tsd":"^0.17.0","typescript":"^4.3.5","xo":"^0.44.0"},"xo":{"ignores":["fixture"]},"gitHead":"6062d95ac0a7d9fd3170f820bc04cb15bae83dc9","bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"homepage":"https://github.com/sindresorhus/detect-indent#readme","_id":"detect-indent@7.0.0","_nodeVersion":"12.22.1","_npmVersion":"7.10.0","dist":{"shasum":"cab58e6ab1129c669e2101181a6c677917d43577","size":3989,"noattachment":false,"key":"/detect-indent/-/detect-indent-7.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-indent/download/detect-indent-7.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/detect-indent_7.0.0_1628461994353_0.5588486496577394"},"_hasShrinkwrap":false,"publish_time":1628461994482,"_cnpm_publish_time":1628461994482},"6.1.0":{"name":"detect-indent","version":"6.1.0","description":"Detect the indentation of code","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/detect-indent.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["indent","indentation","detect","infer","identify","code","string","text","source","space","tab"],"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.2","xo":"^0.24.0"},"xo":{"ignores":["fixture"]},"gitHead":"30044e44e9f29104a04a1b5fc94dbf60b27eaa1b","bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"homepage":"https://github.com/sindresorhus/detect-indent#readme","_id":"detect-indent@6.1.0","_nodeVersion":"12.22.1","_npmVersion":"7.10.0","dist":{"shasum":"592485ebbbf6b3b1ab2be175c8393d04ca0d57e6","size":4016,"noattachment":false,"key":"/detect-indent/-/detect-indent-6.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-indent/download/detect-indent-6.1.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/detect-indent_6.1.0_1622184293359_0.8627676852042994"},"_hasShrinkwrap":false,"publish_time":1622184293545,"_cnpm_publish_time":1622184293545},"6.0.0":{"name":"detect-indent","version":"6.0.0","description":"Detect the indentation of code","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/detect-indent.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["indent","indentation","detect","infer","identify","code","string","text","source","space","tab"],"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.2","xo":"^0.24.0"},"xo":{"ignores":["fixture"]},"gitHead":"e42875ce2ce2e3d63f6ecd4fe79150943340da9e","bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"homepage":"https://github.com/sindresorhus/detect-indent#readme","_id":"detect-indent@6.0.0","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"0abd0f549f69fc6659a254fe96786186b6f528fd","size":3374,"noattachment":false,"key":"/detect-indent/-/detect-indent-6.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-indent/download/detect-indent-6.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/detect-indent_6.0.0_1556628188019_0.9294671604278244"},"_hasShrinkwrap":false,"publish_time":1556628188146,"_cnpm_publish_time":1556628188146},"5.0.0":{"name":"detect-indent","version":"5.0.0","description":"Detect the indentation of code","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/detect-indent.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["indent","indentation","detect","infer","identify","code","string","text","source","space","tab"],"devDependencies":{"ava":"*","xo":"*"},"xo":{"esnext":true},"gitHead":"6c7485c2e5b74abc11a8870b550a9d385beac9e0","bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"homepage":"https://github.com/sindresorhus/detect-indent#readme","_id":"detect-indent@5.0.0","_shasum":"3871cc0a6a002e8c3e5b3cf7f336264675f06b9d","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.6.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"3871cc0a6a002e8c3e5b3cf7f336264675f06b9d","size":3110,"noattachment":false,"key":"/detect-indent/-/detect-indent-5.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-indent/download/detect-indent-5.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/detect-indent-5.0.0.tgz_1476992892715_0.3219247553497553"},"directories":{},"publish_time":1476992894523,"_cnpm_publish_time":1476992894523,"_hasShrinkwrap":false},"4.0.0":{"name":"detect-indent","version":"4.0.0","description":"Detect the indentation of code","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/detect-indent"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["indent","indentation","detect","infer","identify","code","string","text","source","space","tab"],"dependencies":{"repeating":"^2.0.0"},"devDependencies":{"ava":"*","xo":"*"},"xo":{"ignores":["fixture/**"]},"gitHead":"dbbc78fcb37907116eb120a8324070a1df0e8d86","bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"homepage":"https://github.com/sindresorhus/detect-indent","_id":"detect-indent@4.0.0","_shasum":"f76d064352cdf43a1cb6ce619c4ee3a9475de208","_from":".","_npmVersion":"2.13.3","_nodeVersion":"3.0.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"f76d064352cdf43a1cb6ce619c4ee3a9475de208","size":3096,"noattachment":false,"key":"/detect-indent/-/detect-indent-4.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-indent/download/detect-indent-4.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"publish_time":1441618681807,"_cnpm_publish_time":1441618681807,"_hasShrinkwrap":false},"3.0.1":{"name":"detect-indent","version":"3.0.1","description":"Detect the indentation of code","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/detect-indent"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"bin":{"detect-indent":"cli.js"},"engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"files":["index.js","cli.js"],"keywords":["cli","bin","indent","indentation","detect","infer","identify","code","string","text","source","space","tab"],"dependencies":{"get-stdin":"^4.0.1","minimist":"^1.1.0","repeating":"^1.1.0"},"devDependencies":{"mocha":"*"},"gitHead":"c046bec94ac5eefeb67ae4501d556c8dcec2914e","bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"homepage":"https://github.com/sindresorhus/detect-indent","_id":"detect-indent@3.0.1","_shasum":"9dc5e5ddbceef8325764b9451b02bc6d54084f75","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.12.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"dist":{"shasum":"9dc5e5ddbceef8325764b9451b02bc6d54084f75","size":3503,"noattachment":false,"key":"/detect-indent/-/detect-indent-3.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-indent/download/detect-indent-3.0.1.tgz"},"directories":{},"publish_time":1424107885306,"_cnpm_publish_time":1424107885306,"_hasShrinkwrap":false},"3.0.0":{"name":"detect-indent","version":"3.0.0","description":"Detect the indentation of code","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/detect-indent"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"bin":{"detect-indent":"cli.js"},"engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"files":["index.js","cli.js"],"keywords":["cli","bin","indent","indentation","detect","infer","identify","code","string","text","source","space","tab"],"dependencies":{"get-stdin":"^3.0.0","minimist":"^1.1.0","repeating":"^1.1.0"},"devDependencies":{"mocha":"*"},"gitHead":"303b97bc44497bbfeb01eb4ea27753c82156aef6","bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"homepage":"https://github.com/sindresorhus/detect-indent","_id":"detect-indent@3.0.0","_shasum":"7a12c4b61be4ebc170cd6d416ce43754124637d8","_from":".","_npmVersion":"2.1.5","_nodeVersion":"0.10.32","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"dist":{"shasum":"7a12c4b61be4ebc170cd6d416ce43754124637d8","size":2566,"noattachment":false,"key":"/detect-indent/-/detect-indent-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-indent/download/detect-indent-3.0.0.tgz"},"directories":{},"publish_time":1416714343877,"_cnpm_publish_time":1416714343877,"_hasShrinkwrap":false},"2.0.0":{"name":"detect-indent","version":"2.0.0","description":"Detect the indentation of code","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/detect-indent"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"bin":{"detect-indent":"cli.js"},"engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"files":["index.js","cli.js"],"keywords":["cli","bin","indent","indentation","detect","infer","identify","code","string","text","source","space","tab"],"dependencies":{"get-stdin":"^3.0.0","minimist":"^1.1.0","repeating":"^1.1.0"},"devDependencies":{"mocha":"*"},"gitHead":"401f402f06ecc897ba6726440ec93375673d4cc0","bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"homepage":"https://github.com/sindresorhus/detect-indent","_id":"detect-indent@2.0.0","_shasum":"720ff51e4d97b76884f6bf57292348b13dfde939","_from":".","_npmVersion":"2.1.4","_nodeVersion":"0.10.32","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"dist":{"shasum":"720ff51e4d97b76884f6bf57292348b13dfde939","size":2328,"noattachment":false,"key":"/detect-indent/-/detect-indent-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-indent/download/detect-indent-2.0.0.tgz"},"directories":{},"publish_time":1414292704210,"_cnpm_publish_time":1414292704210,"_hasShrinkwrap":false},"1.0.1":{"name":"detect-indent","version":"1.0.1","description":"Detect the indentation of code","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/detect-indent"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"bin":{"detect-indent":"cli.js"},"engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"files":["index.js","cli.js"],"keywords":["cli","bin","indent","indentation","detect","infer","identify","code","string","text","source","space","tab"],"dependencies":{"get-stdin":"^3.0.0","minimist":"^1.1.0","strip-comments":"^0.3.2"},"devDependencies":{"mocha":"*"},"gitHead":"e9caef6f10d89963f55fc0d42e061d770e96683e","bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"homepage":"https://github.com/sindresorhus/detect-indent","_id":"detect-indent@1.0.1","_shasum":"86f3496242b52c910d49876cb993add8bed1f1bd","_from":".","_npmVersion":"2.1.2","_nodeVersion":"0.10.32","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"dist":{"shasum":"86f3496242b52c910d49876cb993add8bed1f1bd","size":2240,"noattachment":false,"key":"/detect-indent/-/detect-indent-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-indent/download/detect-indent-1.0.1.tgz"},"directories":{},"publish_time":1412375805242,"_cnpm_publish_time":1412375805242,"_hasShrinkwrap":false},"1.0.0":{"name":"detect-indent","version":"1.0.0","description":"Detect the indentation of code","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/detect-indent"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"bin":{"detect-indent":"cli.js"},"engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"files":["index.js","cli.js"],"keywords":["cli","bin","indent","indentation","detect","infer","identify","code","string","text","source","space","tab"],"dependencies":{"get-stdin":"^3.0.0","minimist":"^1.1.0","strip-comments":"^0.3.2"},"devDependencies":{"mocha":"*"},"gitHead":"86440344bcefa5245076e6c6516ac1b2d80a4ef1","bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"homepage":"https://github.com/sindresorhus/detect-indent","_id":"detect-indent@1.0.0","_shasum":"17f17ae5b44c740ae89bd386b495187b378a0456","_from":".","_npmVersion":"1.4.23","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"dist":{"shasum":"17f17ae5b44c740ae89bd386b495187b378a0456","size":2099,"noattachment":false,"key":"/detect-indent/-/detect-indent-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-indent/download/detect-indent-1.0.0.tgz"},"directories":{},"publish_time":1410433325021,"_cnpm_publish_time":1410433325021,"_hasShrinkwrap":false},"0.2.0":{"name":"detect-indent","version":"0.2.0","description":"Detect the indentation of code","license":"MIT","repository":{"type":"git","url":"git://github.com/sindresorhus/detect-indent"},"bin":{"detect-indent":"cli.js"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"files":["index.js","cli.js"],"keywords":["cli","bin","indent","indentation","detect","infer","identify","code","string","text","source","space","tab"],"dependencies":{"get-stdin":"^0.1.0","minimist":"^0.1.0"},"devDependencies":{"mocha":"*"},"bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"homepage":"https://github.com/sindresorhus/detect-indent","_id":"detect-indent@0.2.0","_shasum":"042914498979ac2d9f3c73e4ff3e6877d3bc92b6","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"dist":{"shasum":"042914498979ac2d9f3c73e4ff3e6877d3bc92b6","size":1994,"noattachment":false,"key":"/detect-indent/-/detect-indent-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-indent/download/detect-indent-0.2.0.tgz"},"directories":{},"publish_time":1402936858661,"_cnpm_publish_time":1402936858661,"_hasShrinkwrap":false},"0.1.4":{"name":"detect-indent","version":"0.1.4","description":"Detect the indentation of code","keywords":["indent","indentation","detect","infer","identify","code","string","text","source","space","tab"],"license":"MIT","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"files":["detect-indent.js"],"main":"detect-indent","repository":{"type":"git","url":"git://github.com/sindresorhus/detect-indent.git"},"scripts":{"test":"mocha && phantomjs node_modules/mocha-phantomjs/lib/mocha-phantomjs.coffee test/test.html"},"devDependencies":{"mocha":"~1.12.0","chai":"~1.7.2","phantomjs":"~1.9.1","mocha-phantomjs":"~3.1.0"},"engines":{"node":">=0.8.0"},"bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"homepage":"https://github.com/sindresorhus/detect-indent","_id":"detect-indent@0.1.4","dist":{"shasum":"c28e1303c1c4ad5ce0549902b884043afc5906b0","size":1806,"noattachment":false,"key":"/detect-indent/-/detect-indent-0.1.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-indent/download/detect-indent-0.1.4.tgz"},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"publish_time":1398799203852,"_cnpm_publish_time":1398799203852,"_hasShrinkwrap":false},"0.1.3":{"name":"detect-indent","version":"0.1.3","description":"Detect the indentation of code","keywords":["indent","indentation","detect","infer","identify","code","string","text","source","space","tab"],"homepage":"https://github.com/sindresorhus/detect-indent","bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"license":"MIT","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"files":["detect-indent.js"],"main":"detect-indent","repository":{"type":"git","url":"git://github.com/sindresorhus/detect-indent.git"},"scripts":{"test":"mocha && phantomjs node_modules/mocha-phantomjs/lib/mocha-phantomjs.coffee test/test.html"},"devDependencies":{"mocha":"~1.12.0","chai":"~1.7.2","phantomjs":"~1.9.1","mocha-phantomjs":"~3.1.0"},"engines":{"node":">=0.8.0"},"readmeFilename":"readme.md","_id":"detect-indent@0.1.3","dist":{"shasum":"76e6cf5a5fc734e3b4eec4060a43ecd32ecad9f9","size":1836,"noattachment":false,"key":"/detect-indent/-/detect-indent-0.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-indent/download/detect-indent-0.1.3.tgz"},"_from":".","_npmVersion":"1.3.10","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"publish_time":1380146608005,"_cnpm_publish_time":1380146608005,"_hasShrinkwrap":false},"0.1.2":{"name":"detect-indent","version":"0.1.2","description":"Detect the indentation of code","keywords":["indent","indentation","detect","infer","identify","code","string","text","source","space","tab"],"homepage":"https://github.com/sindresorhus/detect-indent","bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"license":"MIT","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"files":["detect-indent.js"],"main":"detect-indent","repository":{"type":"git","url":"git://github.com/sindresorhus/detect-indent.git"},"scripts":{"test":"mocha && phantomjs node_modules/mocha-phantomjs/lib/mocha-phantomjs.coffee test/test.html"},"devDependencies":{"mocha":"~1.12.0","chai":"~1.7.2","phantomjs":"~1.9.1","mocha-phantomjs":"~3.1.0"},"engines":{"node":">=0.8.0"},"readmeFilename":"readme.md","_id":"detect-indent@0.1.2","dist":{"shasum":"b9c31d35d514df22a8ec3725783da824c5f23c03","size":1785,"noattachment":false,"key":"/detect-indent/-/detect-indent-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-indent/download/detect-indent-0.1.2.tgz"},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"publish_time":1377851664581,"_cnpm_publish_time":1377851664581,"_hasShrinkwrap":false},"0.1.1":{"name":"detect-indent","version":"0.1.1","description":"Detect the indentation of code","keywords":["indent","indentation","detect","infer","identify","code","string","text","source","space","tab"],"homepage":"https://github.com/sindresorhus/detect-indent","bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"license":"MIT","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"files":["detect-indent.js"],"main":"detect-indent","repository":{"type":"git","url":"git://github.com/sindresorhus/detect-indent.git"},"scripts":{"test":"mocha && phantomjs node_modules/mocha-phantomjs/lib/mocha-phantomjs.coffee test/test.html"},"devDependencies":{"mocha":"~1.12.0","chai":"~1.7.2","phantomjs":"~1.9.1","mocha-phantomjs":"~3.1.0"},"engines":{"node":">=0.8.0"},"readmeFilename":"readme.md","_id":"detect-indent@0.1.1","dist":{"shasum":"55316047de5171c613a3a205af6a6fcfcda2710d","size":1738,"noattachment":false,"key":"/detect-indent/-/detect-indent-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-indent/download/detect-indent-0.1.1.tgz"},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"publish_time":1376416478934,"_cnpm_publish_time":1376416478934,"_hasShrinkwrap":false},"0.1.0":{"name":"detect-indent","version":"0.1.0","description":"Detect the indentation of code","keywords":["indent","indentation","detect","infer","identify","code","string","text","source","space","tab"],"homepage":"https://github.com/sindresorhus/detect-indent","bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"license":"MIT","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"http://sindresorhus.com"},"files":["detect-indent.js"],"main":"detect-indent","repository":{"type":"git","url":"git://github.com/sindresorhus/detect-indent.git"},"scripts":{"test":"mocha && phantomjs node_modules/mocha-phantomjs/lib/mocha-phantomjs.coffee test/test.html"},"devDependencies":{"mocha":"~1.12.0","chai":"~1.7.2","phantomjs":"~1.9.1","mocha-phantomjs":"~3.1.0"},"engines":{"node":">=0.8.0"},"readmeFilename":"readme.md","_id":"detect-indent@0.1.0","dist":{"shasum":"b071bdece3312b9669147950e7aefb2e5d392327","size":1736,"noattachment":false,"key":"/detect-indent/-/detect-indent-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/detect-indent/download/detect-indent-0.1.0.tgz"},"_from":".","_npmVersion":"1.2.32","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"publish_time":1376180911046,"_cnpm_publish_time":1376180911046,"_hasShrinkwrap":false}},"readme":"# detect-indent\n\n> Detect the indentation of code\n\nPass in a string of any kind of text and get the indentation.\n\n## Use cases\n\n- Persisting the indentation when modifying a file.\n- Have new content match the existing indentation.\n- Setting the right indentation in your editor.\n\n## Install\n\n```sh\nnpm install detect-indent\n```\n\n## Usage\n\nHere we modify a JSON file while persisting the indentation:\n\n```js\nimport fs from 'node:fs';\nimport detectIndent from 'detect-indent';\n\n/*\n{\n    \"ilove\": \"pizza\"\n}\n*/\nconst file = fs.readFileSync('foo.json', 'utf8');\n\n// Tries to detect the indentation and falls back to a default if it can't\nconst indent = detectIndent(file).indent || '    ';\n\nconst json = JSON.parse(file);\n\njson.ilove = 'unicorns';\n\nfs.writeFileSync('foo.json', JSON.stringify(json, undefined, indent));\n/*\n{\n    \"ilove\": \"unicorns\"\n}\n*/\n```\n\n## API\n\nAccepts a string and returns an object with stats about the indentation:\n\n- `type` {'tab' | 'space' | undefined} - The type of indentation. It is `undefined` if no indentation is detected.\n- `amount` {number} - The amount of indentation. For example, `2`.\n- `indent` {string} - The actual indentation.\n\n## Algorithm\n\nThe current algorithm looks for the most common difference between two consecutive non-empty lines. Single-space indentations and changes are ignored by default to prevent common false positives from comment alignment.\n\nIn the following example, even if 4-space indentation appears 3 times while 2-space appears only 2 times, the 2-space indentation is detected because there are 4 indent changes of 2 spaces vs only 2 changes of 4 spaces:\n\n```css\nhtml {\n  box-sizing: border-box;\n}\n\nbody {\n  background: gray;\n}\n\np {\n    line-height: 1.3em;\n    margin-top: 1em;\n    text-indent: 2em;\n}\n```\n\n[Source.](https://medium.com/@heatherarthur/detecting-code-indentation-eff3ed0fb56b#3918)\n\nFurthermore, if there are multiple indent differences with the same usage count, the indentation with the most lines is selected.\n\nIn the following example, the indentation is detected as 4-spaces:\n\n```css\nbody {\n  background: gray;\n}\n\np {\n    line-height: 1.3em;\n    margin-top: 1em;\n    text-indent: 2em;\n}\n```\n\n## Related\n\n- [detect-indent-cli](https://github.com/sindresorhus/detect-indent-cli) - CLI for this module\n- [detect-newline](https://github.com/sindresorhus/detect-newline) - Detect the dominant newline character of a string\n- [detect-indent-rs](https://github.com/stefanpenner/detect-indent-rs) - Rust port\n- [detect-indent-py](https://github.com/Ethan-Vanderheijden/detect-indent-py) - Python port\n","_attachments":{},"homepage":"https://github.com/sindresorhus/detect-indent#readme","bugs":{"url":"https://github.com/sindresorhus/detect-indent/issues"},"license":"MIT"}