- Notifications
You must be signed in to change notification settings - Fork139
The ultimate JavaScript string library
License
panzerdp/voca
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Voca is a JavaScript library for manipulating strings.https://vocajs.pages.dev
v.camelCase('bird flight');// => 'birdFlight'v.sprintf('%s costs $%.2f','Tea',1.5);// => 'Tea costs $1.50'v.slugify('What a wonderful world');// => 'what-a-wonderful-world'
The Voca library offers helpful functions to make string manipulations comfortable:change case, trim, pad, slugify,latinise, sprintf'y, truncate, escape and much more. Themodular design allows to load the entire library, orindividual functions to minimize the application builds. The library isfully tested,well documented andlong-term supported.
- Provides the complete set of functions to manipulate, chop, format, escape and query strings
- Includes detailed, easy to read and searchabledocumentation
- Supports a wide range of environments: Node.js 0.10+, Chrome, Firefox, Safari 7+, Edge 13+, IE 9+
- 100% code coverage
- No dependencies
See the complete documentation athttps://vocajs.pages.dev
Voca can be used in various environments.
Install the library with npm into your local modules directory:
npm install voca
Then in your application require the entire library:
constv=require('voca');v.trim(' Hello World! ');// => 'Hello World'v.sprintf('%d red %s',3,'apples');// => '3 red apples'
Or require individual functions:
constwords=require('voca/words');constslugify=require('voca/slugify');words('welcome to Earth');// => ['welcome', 'to', 'Earth']slugify('caffé latté');// => 'caffe-latte'
Voca is compatible with ES2015 modules to import the entire library:
importvocafrom'voca';voca.kebabCase('goodbye blue sky');// => 'goodbye-blue-sky'
Or import individual functions:
importlastfrom'voca/last';last('sun rises',5);// => 'rises'
Load the UMD builds directly into browser's web page:
dist/voca.min.js
minified production-ready, withsource mapdist/voca.js
uncompressed with comments
<scriptsrc="voca.js"type="text/javascript"></script>
Then a global variablev
is exposed for the entire library:
<scripttype="text/javascript">v.last('wonderful world',5);// => 'world'</script>
For bug reports, documentation typos or feature requests feel free to create anissue.
Please make sure that the same problem wasn't reported already.
For general usage questions please ask onStackOverflow.
Contribution is welcome!
- Create a pull request containing bug fixes or new features. Include unit tests and keep the code coverage report near 100% 😎
- Propose new functions, improvements, better documentation
See more details inContributing guide.
Please note that this project is released with a ContributorCode of Conduct. By participating in this project you agree to abide by its terms.
Dmitri Pavlutin |
Personal blog |
Licensed underMIT
About
The ultimate JavaScript string library