Added lume.wordwrap(); updated README.md and tests

This commit is contained in:
rxi
2015-01-10 20:26:19 +00:00
parent 9b5abf3d58
commit 756d30416d
3 changed files with 45 additions and 0 deletions

View File

@@ -316,6 +316,15 @@ instead of whitespace.
lume.trim(" Hello ") -- Returns "Hello"
```
### lume.wordwrap(str [, limit])
Returns `str` wrapped to `limit` number of characters per line, by default
`limit` is `72`. `limit` can also be a function which when passed a string,
returns `true` if it is too long for a single line.
```lua
-- Returns "Hello world\nThis is a\nshort string"
lume.wordwrap("Hello world. This is a short string", 14)
```
### lume.format(str [, vars])
Returns a formatted string. The values of keys in the table `vars` can be
inserted into the string by using the form `"{key}"` in `str`; numerical keys