Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docs): add 2 missing methods of Map.lua #477

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lua/pl/Map.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,22 @@ local function makelist(t)
return setmetatable(t, require('pl.List'))
end

--- list of keys.
--- return a List of all keys.
-- @class function
-- @name Map:keys
Map.keys = tablex.keys

--- list of values.
--- return a List of all values.
-- @class function
-- @name Map:keys
Tieske marked this conversation as resolved.
Show resolved Hide resolved
Map.values = tablex.values

--- return an iterator over all key-value pairs.
function Map:iter ()
return pairs(self)
end

--- return a List of all key-value pairs, sorted by the keys.
--- return a List of all key-value pairs, sorted by the keys in ascending order.
function Map:items()
local ls = makelist(tablex.pairmap (function (k,v) return makelist {k,v} end, self))
ls:sort(function(t1,t2) return t1[1] < t2[1] end)
Expand Down
Loading