https://github.com/extensionengine/hub3
Parse HUB3 formatted bank reports
https://github.com/extensionengine/hub3
Last synced: 9 months ago
JSON representation
Parse HUB3 formatted bank reports
- Host: GitHub
- URL: https://github.com/extensionengine/hub3
- Owner: ExtensionEngine
- License: mit
- Created: 2020-08-29T00:14:00.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-29T00:20:48.000Z (over 5 years ago)
- Last Synced: 2025-03-05T11:40:48.176Z (10 months ago)
- Language: JavaScript
- Homepage:
- Size: 75.2 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @extensionengine/hub3
[](https://app.circleci.com/pipelines/github/ExtensionEngine/hub3?branch=master)
[](https://packagephobia.now.sh/result?p=@extensionengine/hub3)
[](https://npm.im/@extensionengine/hub3)
[](https://github.com/ExtensionEngine/hub3/blob/master/LICENSE)
[](https://github.com/ExtensionEngine/eslint-config)
> Parse [HUB3](http://com.pbz.hr/download/Format_za_dostavu_izvadaka_klijentima_na_elektronskom_mediju.pdf) formatted bank reports
## Installation
npm install @extensionengine/hub3
## API
#### Table of Contents
- [HUB3Error](#hub3error)
- [isHUB3Error](#ishub3error)
- [Parameters](#parameters)
- [ParserError](#parsererror)
- [parseHUB3](#parsehub3)
- [Parameters](#parameters-1)
- [Examples](#examples)
- [LineRecord](#linerecord)
- [Properties](#properties)
### HUB3Error
**Extends Error**
Base class for all HUB3 specific errors
#### isHUB3Error
Check if error is HUB3 specific error
##### Parameters
- `err` **[Error](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error)** error
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** result
### ParserError
**Extends HUB3Error**
Custom error class used for reporting parsing errors
### parseHUB3
- **See:
**
Parse HUB3 bank report
#### Parameters
- `buffer` **[Buffer](https://nodejs.org/api/buffer.html)** HUB3 file contents
#### Examples
```javascript
const { HUB3Error, parse } = require('@extensionengine/hub3');
const path = require('path');
const { readFileSync } = require('fs');
const hub3 = readFileSync(path.join(__dirname, '../reports/1110779471-20200826.mn'));
try {
const records = parse(hub3);
console.log({ records });
} catch (err) {
if (!HUB3Error.isHUB3Error(err)) throw err;
console.error('Failed to parse report:', err.message);
process.exit(1);
}
```
- Throws **[ParserError](#parsererror)**
Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[LineRecord](#linerecord)>** array of line records
### LineRecord
Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)
#### Properties
- `tip_sloga` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** type