Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

apple-card-csv

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apple-card-csv

Parse an Apple Card statement.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Apple Card Statement

Parses an Apple Card statement.

For older Apple devices supporting Apple Wallet (e.g., iPhone 6, iPhone 5, etc), but no longer supporting OS updates (iOS < 13), users are unable to export their Apple Card statements as CSV.

To support these older devices, this package reads and parses exported statement PDFs for subsequent CSV generation.

Usage

var parse = require( 'apple-card-csv' );
parse( src, clbk )

Parses one or more statements.

var resolve = require( 'path' ).resolve;
var cwd = require( '@stdlib/process/cwd' );
var readFileSync = require( '@stdlib/fs/read-file' ).sync;

var fpath = resolve( cwd(), 'path', 'to', 'statement.pdf' );
var src = readFileSync( fpath );

parse( src, done );

function done( error, data ) {
    if ( error ) {
        return console.error( error.message );
    }
    console.log( data );
}

To parse more than one statement, provide an Array of statements, where each element is a Uint8Array containing statement binary data.

Returned data has the following format:

  • Date: transaction date. The field value has the following format: MM/DD/YYYY.
  • Type transaction type; e.g., 'Transactions', 'Payments', 'Interest Charged'.
  • Description: transaction description.
  • Daily Cash (%): daily cash percentage.
  • Daily Cash ($): daily cash amount.
  • Amount: transaction amount.
[
  {
    'Date': '10/03/2019',
    'Type': 'Transactions',
    'Description': 'FOO BAR',
    'Daily Cash (%)': '2%',
    'Daily Cash ($)': '$1.29',
    'Amount': '$64.31'
  },
  {
    'Date': '10/04/2019',
    'Type': 'Transactions',
    'Description': 'BEEP BOOP',
    'Daily Cash (%)': '2%',
    'Daily Cash ($)': '$0.68',
    'Amount': '$33.98'
  },
  ...
]

Examples

var join = require( 'path' ).join;
var readFileSync = require( '@stdlib/fs/read-file' ).sync;
var parse = require( 'apple-card-csv' );

var fpath = join( __dirname, 'examples', 'fixtures', 'statement.pdf' );
var src = readFileSync( fpath );

parse( src, done );

function done( error, data ) {
    if ( error ) {
        return console.error( error.message );
    }
    console.log( data );
}

CLI

Usage

Usage: apple-card-csv [options] [<file1> <file2> ...]

Options:

  -h,    --help                Print this message.
  -V,    --version             Print the package version.

Notes

  • File paths may be either absolute or relative and are resolved relative to the current working directory.

Examples

$ apple-card-csv ./path/to/statement.pdf
Date,Type,Description,Daily Cash (%),Daily Cash ($),Amount
"10/03/2019","Transactions","FOO BAR","2%","$1.29","$64.31"
"10/04/2019","Transactions","BEEP BOOP","2%","$0.68","$33.98"
...

To use as a standard stream,

$ cat ./path/to/statement.pdf | apple-card-csv
"10/03/2019","Transactions","FOO BAR","2%","$1.29","$64.31"
"10/04/2019","Transactions","BEEP BOOP","2%","$0.68","$33.98"
...

Keywords

FAQs

Package last updated on 21 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc