diff --git a/package.json b/package.json index f209d79..18fc19c 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ "cli-cursor": "^2.1.0", "commander": "^2.12.2", "hms-parse": "^1.0.0", - "lodash": "^4.17.4", "play-sound": "^1.1.2", "timercore": "^1.0.2" } diff --git a/src/renderFactory.js b/src/renderFactory.js index 6818521..d6ff794 100644 --- a/src/renderFactory.js +++ b/src/renderFactory.js @@ -1,7 +1,6 @@ const {cursorTo, clearScreenDown} = require('readline') const {EOL} = require('os') const hms = require('hms-parse') -const zipWith = require('lodash/zipWith') const { zero, one, @@ -40,11 +39,16 @@ const INDENT = ' '.repeat(8) const PADDING = EOL.repeat(3) const SPACING = ' '.repeat(2) -const getLine = (...segments) => INDENT + segments.join(SPACING) +const zipWith = (a, f) => + (a[0].reduce((acc, _, i) => + acc.concat([a.reduce((out, inner) => + out.concat(inner[i]), [])]), [])).map(f) + +const getLine = segments => INDENT + segments.join(SPACING) const getOutput = hmsString => { const characters = [...hmsString].map(val => map[val]) - const lines = zipWith(...characters, getLine) + const lines = zipWith(characters, getLine) return PADDING + lines.join(EOL) + PADDING }