diff options
Diffstat (limited to 'node_modules/trim-off-newlines')
-rw-r--r-- | node_modules/trim-off-newlines/index.js | 7 | ||||
-rw-r--r-- | node_modules/trim-off-newlines/license | 21 | ||||
-rw-r--r-- | node_modules/trim-off-newlines/package.json | 48 | ||||
-rw-r--r-- | node_modules/trim-off-newlines/readme.md | 31 |
4 files changed, 107 insertions, 0 deletions
diff --git a/node_modules/trim-off-newlines/index.js b/node_modules/trim-off-newlines/index.js new file mode 100644 index 000000000..46e3d5729 --- /dev/null +++ b/node_modules/trim-off-newlines/index.js @@ -0,0 +1,7 @@ +'use strict'; + +var regex = /^(?:\r\n|\n|\r)+|(?:\r\n|\n|\r)+$/g; + +module.exports = function (str) { + return str.replace(regex, ''); +}; diff --git a/node_modules/trim-off-newlines/license b/node_modules/trim-off-newlines/license new file mode 100644 index 000000000..04c8e9dfb --- /dev/null +++ b/node_modules/trim-off-newlines/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Steve Mao <maochenyan@gmail.com> (github.com/stevemao) + +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/trim-off-newlines/package.json b/node_modules/trim-off-newlines/package.json new file mode 100644 index 000000000..7b2d8a1a1 --- /dev/null +++ b/node_modules/trim-off-newlines/package.json @@ -0,0 +1,48 @@ +{ + "name": "trim-off-newlines", + "version": "1.0.1", + "description": "Similar to String#trim() but removes only newlines", + "license": "MIT", + "repository": "stevemao/trim-off-newlines", + "author": { + "name": "Steve Mao", + "email": "maochenyan@gmail.com", + "url": "github.com/stevemao" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "trim", + "newlines", + "new-lines", + "newline", + "new-lines", + "string", + "str", + "util", + "utils", + "utility", + "whitespace", + "space", + "remove", + "delete" + ], + "dependencies": {}, + "devDependencies": { + "mocha": "*", + "xo": "*" + }, + "xo": { + "envs": [ + "node", + "mocha" + ] + } +} diff --git a/node_modules/trim-off-newlines/readme.md b/node_modules/trim-off-newlines/readme.md new file mode 100644 index 000000000..36626d90a --- /dev/null +++ b/node_modules/trim-off-newlines/readme.md @@ -0,0 +1,31 @@ +# trim-off-newlines [](https://travis-ci.org/stevemao/trim-off-newlines) + +> Similar to [`String#trim()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim) but removes only newlines + + +## Install + +``` +$ npm install --save trim-off-newlines +``` + + +## Usage + +```js +var trimOffNewlines = require('trim-off-newlines'); + +trimOffNewlines('\n\nunicorns\n\n'); +//=> 'unicorns' +``` + + +## Related + +- [`trim-left`](https://github.com/sindresorhus/trim-left) - Similar to `String#trim()` but removes only whitespace on the left +- [`trim-right`](https://github.com/sindresorhus/trim-right) - Similar to `String#trim()` but removes only whitespace on the right + + +## License + +MIT © [Steve Mao](https://github.com/stevemao) |