diff --git a/src/PKPass.ts b/src/PKPass.ts index 0759387..a1dbb02 100644 --- a/src/PKPass.ts +++ b/src/PKPass.ts @@ -4,8 +4,8 @@ import getModelFolderContents from "./getModelFolderContents"; import * as Schemas from "./schemas"; import * as Signature from "./Signature"; import * as Strings from "./StringsUtils"; +import * as Utils from "./utils"; import { Stream } from "stream"; -import { processDate } from "./utils"; /** Exporting for tests specs */ export const propsSymbol = Symbol("props"); @@ -710,7 +710,7 @@ export default class PKPass extends Bundle { } try { - this[propsSymbol]["expirationDate"] = processDate(date); + this[propsSymbol]["expirationDate"] = Utils.processDate(date); } catch (err) { throw new TypeError( `Cannot set expirationDate. Invalid date ${date}`, @@ -799,7 +799,7 @@ export default class PKPass extends Bundle { } try { - this[propsSymbol]["relevantDate"] = processDate(date); + this[propsSymbol]["relevantDate"] = Utils.processDate(date); } catch (err) { throw new TypeError( `Cannot set relevantDate. Invalid date ${date}`, diff --git a/src/getModelFolderContents.ts b/src/getModelFolderContents.ts index 4186325..d146d2c 100644 --- a/src/getModelFolderContents.ts +++ b/src/getModelFolderContents.ts @@ -1,6 +1,6 @@ import * as path from "path"; +import * as Utils from "./utils"; import formatMessage, { ERROR } from "./messages"; -import { removeHidden } from "./utils"; import { promises as fs } from "fs"; /** @@ -19,7 +19,7 @@ export default async function getModelFolderContents( const modelFilesList = await fs.readdir(modelPath); // No dot-starting files, manifest and signature - const filteredModelRecords = removeHidden(modelFilesList).filter( + const filteredModelRecords = Utils.removeHidden(modelFilesList).filter( (f) => !/(manifest|signature)/i.test(f) && /.+$/.test(path.parse(f).ext), @@ -116,7 +116,7 @@ function getObjectFromModelFile( */ async function readDirectory(filePath: string) { - const dirContent = await fs.readdir(filePath).then(removeHidden); + const dirContent = await fs.readdir(filePath).then(Utils.removeHidden); return dirContent.map(async (fileName) => { const content = await fs.readFile(path.resolve(filePath, fileName));