mirror of
https://github.com/TangentFoxy/lume.git
synced 2025-07-28 02:52:21 +00:00
Made lume.reduce check initial value for nil
instead of non-truthy
Fixes #32
This commit is contained in:
2
lume.lua
2
lume.lua
@@ -286,8 +286,8 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function lume.reduce(t, fn, first)
|
function lume.reduce(t, fn, first)
|
||||||
|
local started = first ~= nil
|
||||||
local acc = first
|
local acc = first
|
||||||
local started = first and true or false
|
|
||||||
local iter = getiter(t)
|
local iter = getiter(t)
|
||||||
for _, v in iter(t) do
|
for _, v in iter(t) do
|
||||||
if started then
|
if started then
|
||||||
|
Reference in New Issue
Block a user