@stdlib/string-trim
Advanced tools
+1
-0
@@ -8,1 +8,2 @@ | ||
| -V, --version Print the package version. | ||
| --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. |
| { | ||
| "string": [ | ||
| "split" | ||
| ], | ||
| "boolean": [ | ||
@@ -3,0 +6,0 @@ "help", |
+1
-1
@@ -1,1 +0,1 @@ | ||
| Copyright (c) 2016-2021 The Stdlib Authors. | ||
| Copyright (c) 2016-2022 The Stdlib Authors. |
+4
-2
| { | ||
| "name": "@stdlib/string-trim", | ||
| "version": "0.0.7", | ||
| "version": "0.0.8", | ||
| "description": "Trim whitespace characters from the beginning and end of a string.", | ||
@@ -43,2 +43,3 @@ "license": "Apache-2.0", | ||
| "dependencies": { | ||
| "@stdlib/assert-is-regexp-string": "^0.0.x", | ||
| "@stdlib/assert-is-string": "^0.0.x", | ||
@@ -50,3 +51,4 @@ "@stdlib/cli-ctor": "^0.0.x", | ||
| "@stdlib/streams-node-stdin": "^0.0.x", | ||
| "@stdlib/string-replace": "^0.0.x" | ||
| "@stdlib/string-replace": "^0.0.x", | ||
| "@stdlib/utils-regexp-from-string": "^0.0.x" | ||
| }, | ||
@@ -53,0 +55,0 @@ "devDependencies": { |
+77
-2
@@ -23,3 +23,3 @@ <!-- | ||
| [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] [![dependencies][dependencies-image]][dependencies-url] | ||
| [![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] <!-- [![dependencies][dependencies-image]][dependencies-url] --> | ||
@@ -110,2 +110,4 @@ > Trim whitespace characters from the beginning and end of a string. | ||
| <!-- CLI usage documentation. --> | ||
| <section class="usage"> | ||
@@ -122,2 +124,3 @@ | ||
| -V, --version Print the package version. | ||
| --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. | ||
| ``` | ||
@@ -129,2 +132,24 @@ | ||
| <!-- CLI usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> | ||
| <section class="notes"> | ||
| ### Notes | ||
| - If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. | ||
| ```bash | ||
| # Not escaped... | ||
| $ echo -n $' foo \n bar ' | trim --split /\r?\n/ | ||
| # Escaped... | ||
| $ echo -n $' foo \n bar ' | trim --split /\\r?\\n/ | ||
| ``` | ||
| - The implementation ignores trailing delimiters. | ||
| </section> | ||
| <!-- /.notes --> | ||
| <section class="examples"> | ||
@@ -146,2 +171,11 @@ | ||
| By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. | ||
| ```bash | ||
| $ echo -n ' foo \t bar \t baz ' | trim --split '\t' | ||
| foo | ||
| bar | ||
| baz | ||
| ``` | ||
| </section> | ||
@@ -155,3 +189,21 @@ | ||
| <!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> | ||
| <section class="related"> | ||
| * * * | ||
| ## See Also | ||
| - <span class="package-name">[`@stdlib/string/left-trim`][@stdlib/string/left-trim]</span><span class="delimiter">: </span><span class="description">trim whitespace characters from the beginning of a string.</span> | ||
| - <span class="package-name">[`@stdlib/string/pad`][@stdlib/string/pad]</span><span class="delimiter">: </span><span class="description">pad a string.</span> | ||
| - <span class="package-name">[`@stdlib/string/right-trim`][@stdlib/string/right-trim]</span><span class="delimiter">: </span><span class="description">trim whitespace characters from the end of a string.</span> | ||
| </section> | ||
| <!-- /.related --> | ||
| <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> | ||
| <section class="main-repo" > | ||
@@ -180,3 +232,3 @@ | ||
| Copyright © 2016-2021. The Stdlib [Authors][stdlib-authors]. | ||
| Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. | ||
@@ -200,5 +252,16 @@ </section> | ||
| <!-- | ||
| [dependencies-image]: https://img.shields.io/david/stdlib-js/string-trim.svg | ||
| [dependencies-url]: https://david-dm.org/stdlib-js/string-trim/main | ||
| --> | ||
| [umd]: https://github.com/umdjs/umd | ||
| [es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules | ||
| [deno-url]: https://github.com/stdlib-js/string-trim/tree/deno | ||
| [umd-url]: https://github.com/stdlib-js/string-trim/tree/umd | ||
| [esm-url]: https://github.com/stdlib-js/string-trim/tree/esm | ||
| [chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg | ||
@@ -217,4 +280,16 @@ [chat-url]: https://gitter.im/stdlib-js/stdlib/ | ||
| [mdn-regexp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions | ||
| <!-- <related-links> --> | ||
| [@stdlib/string/left-trim]: https://www.npmjs.com/package/@stdlib/string-left-trim | ||
| [@stdlib/string/pad]: https://www.npmjs.com/package/@stdlib/string-pad | ||
| [@stdlib/string/right-trim]: https://www.npmjs.com/package/@stdlib/string-right-trim | ||
| <!-- </related-links> --> | ||
| </section> | ||
| <!-- /.links --> |
Sorry, the diff of this file is not supported yet
42167
8.38%185
1.65%287
35.38%9
28.57%