Changed args for lume.any/all(), fixed README.md

* The functions lume.any() and lume.all() now have a default function if
  one is not provided -- their default behaviour with a single argument
  now matches that of Python.
* Updated README.md to reflect changes
* Fixed typo in lume.any()'s example in README.md
* Incremented version revision number
This commit is contained in:
rxi
2014-02-28 12:51:50 +00:00
parent 50eb3d9f52
commit e018498a0d
2 changed files with 12 additions and 8 deletions

View File

@@ -66,18 +66,20 @@ with the resulting values.
lume.map({1, 2, 3}, function(x) return x * 2 end) -- Returns {2, 4, 6}
```
### lume.all(t, fn)
Calls `fn` on each value in `t` table and returns true if all the calls to `fn`
return true.
### lume.all(t [, fn])
Returns true if all the values in `t` table are true. If a `fn` function is
supplied it is called on each value, true is returned if all of the calls to
`fn` return true.
```lua
lume.all({1, 2, 1}, function(x) return x == 1 end) -- Returns false
```
### lume.any(t, fn)
Calls `fn` on each value in `t` table and returns true if any of the
calls to `fn` return true.
### lume.any(t [, fn])
Returns true if any of the values in `t` table are true. If a `fn` function is
supplied it is called on each value, true is returned if any of the calls to
`fn` return true.
```lua
lume.all({1, 2, 1}, function(x) return x == 1 end) -- Returns true
lume.any({1, 2, 1}, function(x) return x == 1 end) -- Returns true
```
### lume.reduce(t, fn, first)