UNPKG

approvals

Version:

Approval Tests Library - Capturing Human Intelligence

28 lines (27 loc) 908 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Namer = void 0; const path_1 = __importDefault(require("path")); class Namer { constructor(basePath, name) { this.basePath = basePath || ""; this.name = name || ""; if (this.name.endsWith(".")) { this.name = this.name.slice(0, -1); } } pathCreator(type, ext = "txt") { const cleanedExt = ext.startsWith(".") ? ext.substring(1) : ext; return path_1.default.join(this.basePath, `${this.name}.${type}.${cleanedExt}`); } getReceivedFile(ext) { return this.pathCreator("received", ext); } getApprovedFile(ext) { return this.pathCreator("approved", ext); } } exports.Namer = Namer;