mirror of
https://github.com/TangentFoxy/lume.git
synced 2025-07-28 11:02:20 +00:00
Moved lume.invert() to be near lume.clone()
This makes the series of python-like functions (map, all, any, reduce, set, filter) consecutive in the source and readme, which seems like a more logical order.
This commit is contained in:
14
README.md
14
README.md
@@ -115,13 +115,6 @@ an error is raised,
|
||||
lume.reduce({1, 2, 3}, function(a, b) return a + b end) -- Returns 6
|
||||
```
|
||||
|
||||
### lume.invert(t)
|
||||
Returns a copy of the table where the keys have become the values and the
|
||||
values the keys.
|
||||
```lua
|
||||
lume.invert({a = "x", b = "y"}) -- returns {x = "a", y = "b"}
|
||||
```
|
||||
|
||||
### lume.set(t [, retainkeys])
|
||||
Returns a copy of the `t` table with all the duplicate values removed. If
|
||||
`retainkeys` is true the table is not treated as an array and retains its
|
||||
@@ -160,6 +153,13 @@ than a string. Creates and returns a new array of the given slice.
|
||||
lume.slice({"a", "b", "c", "d", "e"}, 2, 4) -- Returns {"b", "c", "d"}
|
||||
```
|
||||
|
||||
### lume.invert(t)
|
||||
Returns a copy of the table where the keys have become the values and the
|
||||
values the keys.
|
||||
```lua
|
||||
lume.invert({a = "x", b = "y"}) -- returns {x = "a", y = "b"}
|
||||
```
|
||||
|
||||
### lume.clone(t)
|
||||
Returns a shallow copy of the table `t`.
|
||||
|
||||
|
Reference in New Issue
Block a user