sec-edgar-api
Version:
Fetch and parse SEC earnings reports and other filings. Useful for financial analysis.
52 lines (51 loc) • 1.87 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveQ4FiscalYearMatchingProperties = void 0;
/**
* Properties that should be the same for Q4 and FY
*/
function resolveQ4FiscalYearMatchingProperties(reportWrapper) {
var _a = reportWrapper.getReportsFiscalYearByPeriod(), FY = _a.FY, Q1 = _a.Q1, Q2 = _a.Q2, Q3 = _a.Q3, Q4 = _a.Q4;
if (!FY || !Q1 || !Q2 || !Q3 || !Q4)
return;
var matchingProperties = [
'assetCurrent',
'assetCurrentAccountsReceivable',
'assetCurrentCashEquivalents',
'assetCurrentInventory',
'assetCurrentInvestments',
'assetNonCurrent',
'assetNonCurrentGoodwill',
'assetNonCurrentIntangibleLessGoodwill',
'assetNonCurrentInvestments',
'assetNonCurrentPPEGross',
'assetNonCurrentPPENet',
'assetTotal',
'liabilityCurrent',
'liabilityCurrentAccountsPayable',
'liabilityCurrentDebt',
'liabilityNonCurrent',
'liabilityNonCurrentDebt',
'liabilityTotal',
'equityRetainedEarnings',
'equityTotal',
'dateFiled',
'dateReport',
'sharesOutstanding',
'sharesOutstandingDiluted',
'splitRatio',
];
for (var _i = 0, matchingProperties_1 = matchingProperties; _i < matchingProperties_1.length; _i++) {
var property = matchingProperties_1[_i];
matchProperty(property, Q4, FY);
}
}
exports.resolveQ4FiscalYearMatchingProperties = resolveQ4FiscalYearMatchingProperties;
function matchProperty(propertyName, reportA, reportB) {
var isReportANull = reportA[propertyName] === null;
var value = isReportANull ? reportB[propertyName] : reportA[propertyName];
if (typeof value !== 'number')
return;
reportA[propertyName] = value;
reportB[propertyName] = value;
}