Giter Club home page Giter Club logo

apple-card-csv's Introduction

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"
...

apple-card-csv's People

Contributors

kgryte avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

karthikr194

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.