mirror of
https://github.com/TangentFoxy/lume.git
synced 2025-07-28 11:02:20 +00:00
Added isarray
argument to lume.set
This commit is contained in:
13
README.md
13
README.md
@@ -80,12 +80,6 @@ calls to `fn` return true.
|
||||
lume.all({1, 2, 1}, function(x) return x == 1 end) -- Returns true
|
||||
```
|
||||
|
||||
### lume.set(t)
|
||||
Returns a copy of the array `t` with all the duplicate values removed.
|
||||
```lua
|
||||
lume.set({2, 1, 2, "cat", "cat"}) -- Returns {1, 2, cat}
|
||||
```
|
||||
|
||||
### lume.reduce(t, fn [, first])
|
||||
Applies `fn` on two arguments cumulative to the items of the array `t`, from
|
||||
left to right, so as to reduce the array to a single value. If the `first`
|
||||
@@ -94,6 +88,13 @@ argument is not supplied the accumulator is initialised to `0`.
|
||||
lume.reduce({1, 2, 3}, function(a, b) return a + b end) -- Returns 6
|
||||
```
|
||||
|
||||
### lume.set(t, [, isarray])
|
||||
Returns a copy of the `t` table with all the duplicate values removed. If
|
||||
`isarray` is true the table is treated as an array.
|
||||
```lua
|
||||
lume.set({2, 1, 2, "cat", "cat"}) -- Returns {1, 2, cat}
|
||||
```
|
||||
|
||||
### lume.filter(t, fn [, isarray])
|
||||
Iterates the table `t` and calls `fn` on each value. Returns a new table with
|
||||
only the value which `fn` returned true. If `isarray` is true the table is
|
||||
|
Reference in New Issue
Block a user