UNPKG

@mangosteen/edgar-url

Version:

Get SEC EDGAR URLs for filings and entities.

33 lines 1.62 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatCik = exports.repairCik = exports.validateAccessionNumber = void 0; /** * Check that accession number is in the correct format. */ function validateAccessionNumber(accessionNumber) { if (!/^\d{10}-\d{2}-\d{6,}$/.test(accessionNumber)) { throw new Error('Accession number does not have the correct format.'); } } exports.validateAccessionNumber = validateAccessionNumber; function repairCik(cik, accessionNumber) { if (cik === 903377 && accessionNumber === '0000898430-95-001046') { // Doesn't exist: https://www.sec.gov/Archives/edgar/data/903377/0000898430-95-001046.txt // Exists: https://www.sec.gov/Archives/edgar/data/701169/0000898430-95-001046.txt return 701169; } if (cik === 880026 && accessionNumber === '0001193125-08-024463') { // Broken: https://www.sec.gov/Archives/edgar/data/880026/000119312508024463/0001193125-08-024463.txt // Doesn't exist: https://www.sec.gov/Archives/edgar/data/880026/000119312508024463/0001193125-08-024463.hdr.sgml // Fixed: https://www.sec.gov/Archives/edgar/data/1319519/000119312508024463/0001193125-08-024463.txt // Exists: https://www.sec.gov/Archives/edgar/data/1319519/000119312508024463/0001193125-08-024463.hdr.sgml return 1319519; } return cik; } exports.repairCik = repairCik; function formatCik(cik) { return cik.toString(10).padStart(10, '0'); } exports.formatCik = formatCik; //# sourceMappingURL=utils.js.map