Skip to content
This repository has been archived by the owner on Aug 14, 2023. It is now read-only.

Commit

Permalink
Fix reference issue with time utisl
Browse files Browse the repository at this point in the history
  • Loading branch information
AlMcKinlay committed Sep 30, 2020
1 parent 1466332 commit 9663930
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 1 addition & 2 deletions electron/id3.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
const NodeID3 = require("node-id3");
const msToTime = require("../src/utils").msToTime;

const timestampFormat = "HH:MM:SS";

import { msToTime } from "../src/utils";

const timeToMS = (time) => {
if (time === timestampFormat) {
return undefined;
Expand Down
9 changes: 7 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export const sideEffect = (fn) => (d) => {
const sideEffect = (fn) => (d) => {
fn(d);
return d;
};

export const msToTime = (s) => {
const msToTime = (s) => {
// Pad to 2 or 3 digits, default is 2
function pad(n, z) {
z = z || 2;
Expand All @@ -21,3 +21,8 @@ export const msToTime = (s) => {

return `${pad(hrs)}:${pad(mins)}:${pad(secs)}${ms ? `.${pad(ms, 3)}` : ""}`;
};

module.exports = {
sideEffect,
msToTime,
};

0 comments on commit 9663930

Please sign in to comment.