Skip to content

Commit 1130262

Browse files
committed
Removed assert and added tonumber
1 parent 134d60d commit 1130262

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lua/pomodoro/pomodoro.lua

+2-4
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ function pomodoro.isInLongBreak()
111111
end
112112

113113
function pomodoro.startBreak(time)
114-
assert(type(time) == "number", "Expected a number value")
115-
local break_duration = time * MIN_IN_MS or pomodoro.break_duration
114+
local break_duration = tonumber(time) * MIN_IN_MS or pomodoro.break_duration
116115
pomodoro.phase = Phases.BREAK
117116
pomodoro.break_count = pomodoro.break_count + 1
118117
if pomodoro.isInLongBreak() then
@@ -131,8 +130,7 @@ function pomodoro.endBreak()
131130
end
132131

133132
function pomodoro.start(time)
134-
assert(type(time) == "number", "Expected a number value")
135-
local work_duration = time * MIN_IN_MS or pomodoro.work_duration
133+
local work_duration = tonumber(time) * MIN_IN_MS or pomodoro.work_duration
136134
info("Work session of " .. work_duration / MIN_IN_MS .. "m started!")
137135
pomodoro.phase = Phases.RUNNING
138136
pomodoro.startTimer(work_duration, pomodoro.startBreak)

0 commit comments

Comments
 (0)