0.1.0 • Published 13 years ago

arnold v0.1.0

Weekly downloads
6
License
-
Repository
github
Last release
13 years ago

Arnold

Build Status

Arnold is tiny JavaScript library for string manipulation. You can use it on server side as well on client side.

Features

  • Arnold has no dependencies
  • AMD compatible, you can load it via RequireJS
  • Lightweight
  • Fully documented

Download

To install Arnold, use NPM.

$ npm install arnold

Releases are available for download from GitHub.

VersionDescriptionSizeAction
arnold.jsuncompressed, with comments1 KBDownload
arnold.min.jscompressed, without comments1 KBDownload

Documentation

Arnold.capitalize('lorem ipsum dolor isamet'); // => Lorem ipsum dolor isamet
Arnold.chars('lorem'); // => ['l', 'o', 'r', 'e', 'm']
Arnold.chop('lorem ipsum dolor', 4); // => ['lore', 'm ip', 'sum ', 'dolo', 'r']
Arnold.count('lorem ipsum dolor', 'lor'); // => 2
Arnold.countCharacters('lorem'); // => 5
Arnold.countLines('Lorem ipsum.\n Dolor isamet.'); // => 2
Arnold.countWords('lorem ipsum'); // => 2
Arnold.escape('<strong>'); // => &ltstrong&gt
Arnold.getLongestWord(['lorem', 'ipsum', 'dolor', 'isamet']); // => isamet
Arnold.getShortestWord(['lo', 'rem']); // => lo
Arnold.includes('lorem ipsum', 'rem'); // => true
Arnold.join(['Hello', 'World'], ' '); // => Hello World
Arnold.lines('Lorem ipsum.\n Dolor isamet.'); // => ['Lorem ipsum.', 'Dolor isamet.']
Arnold.ltrim('  Hello!  '); // => "Hello!  "
Arnold.reverse('Hello!'); // => !olleH
Arnold.rtrim('  Hello!  '); // => "  Hello!"
Arnold.stripTags('<strong>Hello!</strong>'); // => Hello!
Arnold.titleize('lorem ipsum dolor'); // => Lorem Ipsum Dolor
Arnold.toBoolean(1); // => true
Arnold.toFloat('12.345 lorem ipsum'); // => 12.345
Arnold.toInt(12.345); // => 12
Arnold.toLowercase('HELLO!'); // => hello!
Arnold.toNumber('123'); // => 123
Arnold.toUppercase('hello!'); // => HELLO!
Arnold.trim('  Hello!  '); // => Hello!
Arnold.truncate('Lorem ipsum dolor isamet pidet quidu delime.', 10); // => Lorem ipsu...
Arnold.truncate('Lorem ipsum dolor isamet pidet quidu delime.', 10, '---'); // => Lorem ipsu---
Arnold.unescape('&ltstrong&gt'); // => <strong>
Arnold.words('Lorem ipsum dolor isamet pidet quidu delime.'); // => ['Lorem', 'ipsum', 'dolor', 'isamet', 'pidet', 'quidu', 'delime.']

Running Tests

$ npm test

License

(The MIT License)

Copyright (c) 2011 František Hába <hello@frantisekhaba.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.