Skip to content

Commit

Permalink
add table.merge
Browse files Browse the repository at this point in the history
  • Loading branch information
line0 committed Nov 22, 2015
1 parent 62d16dd commit 63acc29
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Functional.moon
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,14 @@ _table = {

return mapped, m + n

merge: (target, source, overwrite = true) ->
mergeCnt = 0
for k, v in pairs source
if overwrite or not target[k]
target[k] = v
mergeCnt += 1
return mergeCnt

pick: (tbl, selector) ->
picked, p = {}, 0

Expand Down

0 comments on commit 63acc29

Please sign in to comment.