UNPKG

job-hoarder

Version:

Job board aggregator to pull in standardized job postings from company job pages

52 lines (51 loc) 1.87 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var utils_1 = require("../utils"); var JazzAPIParser = /** @class */ (function () { function JazzAPIParser(boardName) { var _this = this; /** * Parse jobs from request result * @param {string} data String of jobs * @returns {array} List of parsed jobs */ this.parseJobs = function (data) { if (!data) throw new Error('No jobs to parse'); var jobs = utils_1.ensureJSON(data); return jobs.map(_this.parseJob); }; /** * Parses job from request result * @param {string} data String of job result * @returns {object} Object of parsed job */ this.parseJob = function (data) { if (!data) throw new Error('No job to parse'); var job = utils_1.ensureJSON(data); return { id: job.id, url: "https://" + _this.boardName + ".applytojob.com/apply/" + job.board_code, title: job.title, datePosted: new Date(job.original_open_date), jobLocation: job.city + ", " + job.state + ", " + job.country_id, department: job.department, description: job.description, }; }; /** * Parses applications from request result * @param {string} data String of application results * @returns {array} List of applications */ this.parseApplications = function (data) { if (!data) throw new Error('No applications to parse'); return utils_1.ensureJSON(data); }; this.boardName = boardName; } return JazzAPIParser; }()); exports.default = JazzAPIParser;