https://github.com/dwjft/ebcdic-parser
parse ebcdic numbers
https://github.com/dwjft/ebcdic-parser
ebcdic parser
Last synced: 9 months ago
JSON representation
parse ebcdic numbers
- Host: GitHub
- URL: https://github.com/dwjft/ebcdic-parser
- Owner: dwjft
- License: mit
- Created: 2019-01-07T17:51:08.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-07T21:19:03.000Z (almost 7 years ago)
- Last Synced: 2025-03-18T14:03:38.006Z (10 months ago)
- Topics: ebcdic, parser
- Language: TypeScript
- Size: 29.3 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# EBCDIC Number Parser
This is a really simple package built for parsing EBCDIC "Zoned Decimal" numbers.
## Installation
npm i --save ebcdic-parser
## Usage
```typescript
import { parse } from 'ebcdic-parser';
const result = parse('0001529B', 2); // string, decimal places (default 2)
console.log(result);
// output: 152.92
```
## Map
```js
const chars = {
negative: ['}', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R'],
positive: ['{', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I'],
};
```
The index of a char is the number it represents. For example, `J` is equal to `-1`.
If the char is not found, the char provided will be returned. Commonly, that would be `1` in place of `A`.
## Examples
See `./src/index.test.ts`.