Changed utils import namespace

This commit is contained in:
Alexander Cerutti
2021-10-14 18:22:23 +02:00
parent 7879a32dc1
commit 52fafd4405
2 changed files with 6 additions and 6 deletions

View File

@@ -4,8 +4,8 @@ import getModelFolderContents from "./getModelFolderContents";
import * as Schemas from "./schemas"; import * as Schemas from "./schemas";
import * as Signature from "./Signature"; import * as Signature from "./Signature";
import * as Strings from "./StringsUtils"; import * as Strings from "./StringsUtils";
import * as Utils from "./utils";
import { Stream } from "stream"; import { Stream } from "stream";
import { processDate } from "./utils";
/** Exporting for tests specs */ /** Exporting for tests specs */
export const propsSymbol = Symbol("props"); export const propsSymbol = Symbol("props");
@@ -710,7 +710,7 @@ export default class PKPass extends Bundle {
} }
try { try {
this[propsSymbol]["expirationDate"] = processDate(date); this[propsSymbol]["expirationDate"] = Utils.processDate(date);
} catch (err) { } catch (err) {
throw new TypeError( throw new TypeError(
`Cannot set expirationDate. Invalid date ${date}`, `Cannot set expirationDate. Invalid date ${date}`,
@@ -799,7 +799,7 @@ export default class PKPass extends Bundle {
} }
try { try {
this[propsSymbol]["relevantDate"] = processDate(date); this[propsSymbol]["relevantDate"] = Utils.processDate(date);
} catch (err) { } catch (err) {
throw new TypeError( throw new TypeError(
`Cannot set relevantDate. Invalid date ${date}`, `Cannot set relevantDate. Invalid date ${date}`,

View File

@@ -1,6 +1,6 @@
import * as path from "path"; import * as path from "path";
import * as Utils from "./utils";
import formatMessage, { ERROR } from "./messages"; import formatMessage, { ERROR } from "./messages";
import { removeHidden } from "./utils";
import { promises as fs } from "fs"; import { promises as fs } from "fs";
/** /**
@@ -19,7 +19,7 @@ export default async function getModelFolderContents(
const modelFilesList = await fs.readdir(modelPath); const modelFilesList = await fs.readdir(modelPath);
// No dot-starting files, manifest and signature // No dot-starting files, manifest and signature
const filteredModelRecords = removeHidden(modelFilesList).filter( const filteredModelRecords = Utils.removeHidden(modelFilesList).filter(
(f) => (f) =>
!/(manifest|signature)/i.test(f) && !/(manifest|signature)/i.test(f) &&
/.+$/.test(path.parse(f).ext), /.+$/.test(path.parse(f).ext),
@@ -116,7 +116,7 @@ function getObjectFromModelFile(
*/ */
async function readDirectory(filePath: string) { 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) => { return dirContent.map(async (fileName) => {
const content = await fs.readFile(path.resolve(filePath, fileName)); const content = await fs.readFile(path.resolve(filePath, fileName));