Readme.md
1
2# trim
3
4 Trims string whitespace.
5
6## Installation
7
8```
9$ npm install trim
10$ component install component/trim
11```
12
13## API
14
15 - [trim(str)](#trimstr)
16 - [.left(str)](#leftstr)
17 - [.right(str)](#rightstr)
18<a name="" />
19
20<a name="trimstr" />
21### trim(str)
22should trim leading / trailing whitespace.
23
24```js
25trim(' foo bar ').should.equal('foo bar');
26trim('\n\n\nfoo bar\n\r\n\n').should.equal('foo bar');
27```
28
29<a name="leftstr" />
30### .left(str)
31should trim leading whitespace.
32
33```js
34trim.left(' foo bar ').should.equal('foo bar ');
35```
36
37<a name="rightstr" />
38### .right(str)
39should trim trailing whitespace.
40
41```js
42trim.right(' foo bar ').should.equal(' foo bar');
43```
44
45## Development
46
47Run tests with
48
49```js
50npx mocha
51```
52
53
54## License
55
56(The MIT License)
57
58Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
59
60Permission is hereby granted, free of charge, to any person obtaining
61a copy of this software and associated documentation files (the
62'Software'), to deal in the Software without restriction, including
63without limitation the rights to use, copy, modify, merge, publish,
64distribute, sublicense, and/or sell copies of the Software, and to
65permit persons to whom the Software is furnished to do so, subject to
66the following conditions:
67
68The above copyright notice and this permission notice shall be
69included in all copies or substantial portions of the Software.
70
71THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
72EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
73MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
74IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
75CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
76TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
77SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.