ebcdic-parser
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

EBCDIC Number Parser

This is a really simple package built for parsing EBCDIC "Zoned Decimal" numbers.

Usage

import { parse } from 'ebcdic-parser';
 
const result = parse('0001529B', 2); // string, decimal places (default 2)
console.log(result);
// output: 152.92

Map

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.

Readme

Keywords

Package Sidebar

Install

npm i ebcdic-parser

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

11.5 kB

Total Files

10

Last publish

Collaborators

  • dwjft