@firela/parser-hk
v0.1.1
Published
Hong Kong payment parser implementations (HSBC) for financial file formats
Maintainers
Readme
@firela/parser-hk
Hong Kong bank statement parsers for FireLa.
Installation
npm install @firela/parser-hkPeer Dependencies
This package requires the following peer dependencies:
npm install chrono-node csv-parseSupported Formats
Bank Parsers
| Parser | Format | Description |
|--------|--------|-------------|
| HsbcHkParser | CSV | HSBC Hong Kong Credit Card and Debit/Savings statements (dual-format) |
Usage
import { HsbcHkParser } from '@firela/parser-hk';
// Identify and parse HSBC HK CSV
const hsbcParser = new HsbcHkParser();
const buffer = fs.readFileSync('hsbc_statement.csv');
if (hsbcParser.identify(buffer)) {
const result = hsbcParser.parse(buffer);
if (result.success) {
console.log(result.data.transactions);
// => RawTransaction[] with BankCustomFields
console.log(result.data.metadata);
// => { accountNumber, accountType, statementPeriod, ... }
}
}HSBC HK Format Support
The HsbcHkParser supports two CSV formats:
- Credit Card Format - Date, Description, Debit, Credit columns
- Debit/Savings Format - Date, Description, Deposits, Withdrawals, Balance columns
The parser automatically detects the format based on header keywords.
Output Format
All parsers return RawTransaction objects with bank-specific custom fields:
interface RawTransaction {
date: Date;
payee: string;
amount: Decimal;
currency: string; // HKD for HSBC HK
direction: 'in' | 'out';
description: string;
customFields: BankCustomFields;
}License
MIT
