From 95ea8e9ad3c81d29cc38977867179b4a61c5eee5 Mon Sep 17 00:00:00 2001 From: Max Isom Date: Fri, 20 Mar 2020 20:51:33 -0500 Subject: [PATCH] Remove redundent code --- src/commands/seek.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/commands/seek.ts b/src/commands/seek.ts index 89e174e..de8f03e 100644 --- a/src/commands/seek.ts +++ b/src/commands/seek.ts @@ -5,6 +5,7 @@ import PlayerManager from '../managers/player'; import LoadingMessage from '../utils/loading-message'; import errorMsg from '../utils/error-msg'; import Command from '.'; +import {parseTime} from '../utils/time'; @injectable() export default class implements Command { @@ -44,14 +45,7 @@ export default class implements Command { let seekTime = 0; if (time.includes(':')) { - const timeGroups = time.split(':').map(t => parseInt(t, 10)); - let currentTimePeriod = 1; - - for (let i = timeGroups.length - 1; i >= 0; i--) { - seekTime += currentTimePeriod * timeGroups[i]; - - currentTimePeriod *= 60; - } + seekTime = parseTime(time); } else { seekTime = parseInt(time, 10); }