Functions that assist in working with strings. Node.js
CoffeeScript JavaScript Makefile
Latest commit e8cce83 Jun 11, 2016 @vesln committed on GitHub Update Readme.md
Permalink
Failed to load latest commit information.
lib Use latest super & lingo Dec 10, 2013
src Use latest super & lingo Dec 10, 2013
test Update to latest mocha and should Dec 10, 2013
.gitignore Removing lib from the gitignore file Jan 6, 2012
.travis.yml Migrate to hydro entirely Dec 10, 2013
History.md 0.2.4 Jan 22, 2012
LICENSE Cleanup Dec 10, 2013
Makefile
Readme.md Update Readme.md Jun 11, 2016
hydro.conf.js Migrate to hydro entirely Dec 10, 2013
package.json Use latest super & lingo Dec 10, 2013

Readme.md

Build Status

Important Notice

I'm no longer actively maintaining this project. If you are interested supporting it - ping me on twitter. The only thing that I will ask you is to not change the API drastically. If you are planning on doing that - better start a brand new project.

If you want me to transfer you only the name on npm, I'd be happy to only if the project does not have any downloads on npm lately. In case it's being downloaded, there are people that depend on it and might step up and start maintaining, so I will not transfer it to you, regardless if you want to release a new major version etc.

If you have any other questions, let me know.

Thanks!

Veselin

word

screenshot

Description

Word contains functions that assist in working with strings.

Features

  • strip slashes
  • strip quotes
  • quotes to entities
  • random strings
  • repeat string
  • censor words in text
  • strip links
  • auto links
  • excerpts
  • word limit
  • pluralize
  • join
  • capitalize
  • camel-case
  • slug
word = require 'word'

result = null

result = word.stripSlashes "O\\'reilly" # strips slashes.

result = word.stripQuotes "foo ' bar" # strips quotes

result = word.quotesEntities "foo ' bar" # quotes to entities

result = word.random 5 # returns random string with length of 5

result = word.repeat 'foo', 3 # repeats n times a string

result = word.censor 'foo', 'foo', '***' # censors bad words.

result = word.censor 'foo bar baz', ['foo', 'bar'], '***'

result = word.stripLinks 'baz <a href="http://example.com" class="foobar">Foo</a>' # strips links

result = word.autoLink "http://example.com/" # links -> a + href

result = word.excerpt 'foobar', 3 # extracts an excerpt from string

result = word.limit 'foo bar baz bar foo.', 3 # limits text to n words.

result = word.wrap 'foooo bar baz', 3 # wraps text to given length.

result = word.pluralize 2, 'dog' # pluralize or not, depends on supplied count.

Want to use it as helper in your express app? Sure.

Install

$ npm install word

Tests

$ npm install
$ make test

License

MIT License