pinoy-kredit-parser 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.MD +36 -24
  2. package/package.json +1 -1
package/README.MD CHANGED
@@ -1,6 +1,6 @@
1
1
  # pinoy-kredit-parser
2
2
 
3
- A lightweight Node.js library for parsing Philippine credit card statement PDFs into structured transaction data.
3
+ A lightweight, isomorphic library for parsing Philippine credit card statement PDFs into structured transaction data. Works in Node.js, Browsers, and Next.js.
4
4
 
5
5
  Currently supports:
6
6
 
@@ -39,44 +39,50 @@ npm install pinoy-kredit-parser
39
39
  ---
40
40
 
41
41
  ## Usage
42
+ The library automatically detects your environment (Node vs. Browser) to provide the correct parsing engine.
43
+
42
44
  ### Using a file path (Node.js)
43
45
  ```javascript
44
- const { parseKredit, BankType } = require('pinoy-kredit-parser')
46
+ import { parseKredit, BankType } from 'pinoy-kredit-parser';
45
47
 
46
- async function main() {
47
- const transactions = await parseKredit('statement.pdf', {
48
+ const transactions = await parseKredit('./statement.pdf', {
48
49
  bank: BankType.RCBC,
49
- })
50
-
51
- console.log(transactions)
52
- }
53
-
54
- main()
50
+ });
55
51
  ```
56
- ### Using a File object (Browser / modern runtimes)
52
+ ### Browser / Next.js Client Components (File or ArrayBuffer)
57
53
  ```javascript
58
- import { parseKredit, BankType } from 'pinoy-kredit-parser'
59
-
60
- async function handleFile(file) {
61
- const transactions = await parseKredit(file, {
62
- bank: BankType.METROBANK,
63
- })
54
+ import { parseKredit, BankType } from 'pinoy-kredit-parser';
55
+
56
+ const handleUpload = async (event) => {
57
+ const file = event.target.files[0];
58
+ const transactions = await parseKredit(file, {
59
+ bank: BankType.UNIONBANK,
60
+ });
61
+ };
62
+ ```
64
63
 
65
- console.log(transactions)
66
- }
64
+ ### Next.js (App Router / API Routes)
65
+ When using this library in Next.js, you must add it to `serverExternalPackages` in your `next.config.ts` to correctly handle the native PDF rendering binaries.
66
+ ```javascript
67
+ // next.config.ts
68
+ const nextConfig = {
69
+ experimental: {
70
+ serverExternalPackages: ['pinoy-kredit-parser', 'pdf-parse', '@napi-rs/canvas'],
71
+ },
72
+ };
67
73
  ```
68
74
 
69
75
  ---
70
76
 
71
77
  ## Output Format
72
78
 
73
- Each transaction is returned as:
79
+ Transactions are returned in a clean, structured format:
74
80
  ```typescript
75
81
  type KreditTransaction = {
76
- saleDate: string
77
- postDate: string
78
- description: string
79
- amount: number
82
+ saleDate: string; // MM/DD/YY
83
+ postDate: string; // MM/DD/YY
84
+ description: string;
85
+ amount: number; // Positive for purchases, negative for payments/credits
80
86
  }
81
87
  ```
82
88
  Example:
@@ -90,6 +96,12 @@ Example:
90
96
  }
91
97
  ]
92
98
  ```
99
+ ---
100
+ ## Features
101
+ - **Isomorphic:** Shared logic for server-side and client-side parsing.
102
+ - **Zero Global Pollution:** No need for manual DOMMatrix or Canvas polyfills.
103
+ - **Next.js Ready:** Optimized for modern frameworks with automatic environment detection.
104
+ - **Privacy-First:** All parsing happens locally on your machine. No data is ever sent to a server.
93
105
 
94
106
  ---
95
107
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinoy-kredit-parser",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Philippine credit card statement parser",
5
5
  "main": "./dist/node.js",
6
6
  "browser": "./dist/browser.js",