Skip to content
/ Arnold Public

Tiny JavaScript library for string manipulation

Notifications You must be signed in to change notification settings

Baggz/Arnold

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Version Description Size Action
arnold.js uncompressed, with comments 1 KB Download
arnold.min.js compressed, without comments 1 KB Download

Documentation

### Capitalize
Arnold.capitalize('lorem ipsum dolor isamet'); // => Lorem ipsum dolor isamet
### Chars
Arnold.chars('lorem'); // => ['l', 'o', 'r', 'e', 'm']
### Chop
Arnold.chop('lorem ipsum dolor', 4); // => ['lore', 'm ip', 'sum ', 'dolo', 'r']
### Count
Arnold.count('lorem ipsum dolor', 'lor'); // => 2
### CountCharacters
Arnold.countCharacters('lorem'); // => 5
### CountLines
Arnold.countLines('Lorem ipsum.\n Dolor isamet.'); // => 2
### CountWords
Arnold.countWords('lorem ipsum'); // => 2
### Escape
Arnold.escape('<strong>'); // => &ltstrong&gt
### GetLongestWord
Arnold.getLongestWord(['lorem', 'ipsum', 'dolor', 'isamet']); // => isamet
### GetShortestWord
Arnold.getShortestWord(['lo', 'rem']); // => lo
### Includes
Arnold.includes('lorem ipsum', 'rem'); // => true
### Join
Arnold.join(['Hello', 'World'], ' '); // => Hello World
### Lines
Arnold.lines('Lorem ipsum.\n Dolor isamet.'); // => ['Lorem ipsum.', 'Dolor isamet.']
### LTrim
Arnold.ltrim('  Hello!  '); // => "Hello!  "
### Reverse
Arnold.reverse('Hello!'); // => !olleH
### RTrim
Arnold.rtrim('  Hello!  '); // => "  Hello!"
### StripTags
Arnold.stripTags('<strong>Hello!</strong>'); // => Hello!
### Titleize
Arnold.titleize('lorem ipsum dolor'); // => Lorem Ipsum Dolor
### ToBoolean
Arnold.toBoolean(1); // => true
### ToFloat
Arnold.toFloat('12.345 lorem ipsum'); // => 12.345
### ToInt
Arnold.toInt(12.345); // => 12
### ToLowercase
Arnold.toLowercase('HELLO!'); // => hello!
### ToNumber
Arnold.toNumber('123'); // => 123
### ToUppercase
Arnold.toUppercase('hello!'); // => HELLO!
### Trim
Arnold.trim('  Hello!  '); // => Hello!
### Truncate
Arnold.truncate('Lorem ipsum dolor isamet pidet quidu delime.', 10); // => Lorem ipsu...
Arnold.truncate('Lorem ipsum dolor isamet pidet quidu delime.', 10, '---'); // => Lorem ipsu---
### Unescape
Arnold.unescape('&ltstrong&gt'); // => <strong>
### Words
Arnold.words('Lorem ipsum dolor isamet pidet quidu delime.'); // => ['Lorem', 'ipsum', 'dolor', 'isamet', 'pidet', 'quidu', 'delime.']
$ 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.

About

Tiny JavaScript library for string manipulation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published