convert-to-spaces
Advanced tools
Comparing version 1.0.0 to 1.0.1
'use strict'; | ||
const repeating = require('repeating'); | ||
module.exports = (str, spaces) => { | ||
spaces = spaces || 2; | ||
return str.replace(/^\t+/gm, $1 => repeating($1.match(/\t/g).length * spaces)); | ||
return str.replace(/^\t+/gm, $1 => ' '.repeat($1.length * (spaces || 2))); | ||
}; |
{ | ||
"name": "convert-to-spaces", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Convert tabs to spaces in a string", | ||
@@ -25,5 +25,2 @@ "license": "MIT", | ||
], | ||
"dependencies": { | ||
"repeating": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
@@ -30,0 +27,0 @@ "ava": "^0.16.0", |
@@ -42,4 +42,9 @@ # convert-to-spaces [![Build Status](https://travis-ci.org/vdemedes/convert-to-spaces.svg?branch=master)](https://travis-ci.org/vdemedes/convert-to-spaces) | ||
## Related | ||
- [convert-to-tabs](https://github.com/vdemedes/convert-to-tabs) - Convert spaces to tabs. | ||
## License | ||
MIT © [vdemedes](https://github.com/vdemedes) |
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
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
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
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
0
50
2551
4
- Removedrepeating@^3.0.0
- Removedrepeating@3.0.0(transitive)