diff options
Diffstat (limited to 'node_modules/convert-to-spaces')
-rw-r--r-- | node_modules/convert-to-spaces/index.js | 5 | ||||
-rw-r--r-- | node_modules/convert-to-spaces/license | 21 | ||||
-rw-r--r-- | node_modules/convert-to-spaces/package.json | 25 | ||||
-rw-r--r-- | node_modules/convert-to-spaces/readme.md | 48 |
4 files changed, 99 insertions, 0 deletions
diff --git a/node_modules/convert-to-spaces/index.js b/node_modules/convert-to-spaces/index.js new file mode 100644 index 000000000..b61b17f0d --- /dev/null +++ b/node_modules/convert-to-spaces/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = (str, spaces) => { + return str.replace(/^\t+/gm, $1 => ' '.repeat($1.length * (spaces || 2))); +}; diff --git a/node_modules/convert-to-spaces/license b/node_modules/convert-to-spaces/license new file mode 100644 index 000000000..85d4fee2c --- /dev/null +++ b/node_modules/convert-to-spaces/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Vadim Demedes <vdemedes@gmail.com> (https://vadimdemedes.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/convert-to-spaces/package.json b/node_modules/convert-to-spaces/package.json new file mode 100644 index 000000000..1f85fa0fe --- /dev/null +++ b/node_modules/convert-to-spaces/package.json @@ -0,0 +1,25 @@ +{ + "name": "convert-to-spaces", + "version": "1.0.2", + "description": "Convert tabs to spaces in a string", + "license": "MIT", + "repository": "vadimdemedes/convert-to-spaces", + "author": "Vadim Demedes <vdemedes@gmail.com>", + "keywords": [ + "tabs", + "spaces" + ], + "engines": { + "node": ">= 4" + }, + "scripts": { + "test": "xo && ava" + }, + "files": [ + "index.js" + ], + "devDependencies": { + "ava": "^0.18.2", + "xo": "^0.17.1" + } +} diff --git a/node_modules/convert-to-spaces/readme.md b/node_modules/convert-to-spaces/readme.md new file mode 100644 index 000000000..9eccf42d0 --- /dev/null +++ b/node_modules/convert-to-spaces/readme.md @@ -0,0 +1,48 @@ +# convert-to-spaces [](https://travis-ci.org/vadimdemedes/convert-to-spaces) + +> Convert tabs to spaces in a string + + +## Install + +``` +$ npm install --save convert-to-spaces +``` + + +## Usage + +```js +const convertToSpaces = require('convert-to-spaces'); + +convertToSpaces('\t\thello!'); +//=> ' hello!' +``` + + +## API + +### convertToSpaces(str, [spaces]) + +#### str + +Type: `string` + +Source string. + +#### spaces + +Type: `number`<br> +Default: `2` + +Number of spaces instead of each tab. + + +## Related + +- [convert-to-tabs](https://github.com/vadimdemedes/convert-to-tabs) - Convert spaces to tabs. + + +## License + +MIT © [Vadim Demedes](https://vadimdemedes.com) |