JSPM

  • Created
  • Published
  • Downloads 25
  • Score
    100M100P100Q78086F
  • License MIT

Sorts double-entry bookkeeping CSV coming from internet banking

Package Exports

  • csv-sort

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (csv-sort) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

csv-sort

Sorts double-entry bookkeeping CSV coming from internet banking

Install

npm i csv-sort

Quick Take

import { strict as assert } from "assert";
import { sort } from "csv-sort";

// Sorts double-entry bookkeeping CSV's - bank statements for example
// see https://en.wikipedia.org/wiki/Double-entry_bookkeeping

assert.deepEqual(
  sort(`Acc Number,Description,Debit Amount,Credit Amount,Balance,
123456,Client #1 payment,,1000,1940
123456,Bought carpet,30,,950
123456,Bought table,10,,940
123456,Bought pens,10,,1000
123456,Bought chairs,20,,980
`),
  {
    res: [
      ["Acc Number", "Description", "Debit Amount", "Credit Amount", "Balance"],
      ["123456", "Client #1 payment", "", "1000", "1940"],
      ["123456", "Bought table", "10", "", "940"],
      ["123456", "Bought carpet", "30", "", "950"],
      ["123456", "Bought chairs", "20", "", "980"],
      ["123456", "Bought pens", "10", "", "1000"],
    ],
    msgContent: null,
    msgType: null,
  }
);
// you'll have to join elements and lines from the array yourself

Documentation

Please visit codsen.com for a full description of the API and examples.

Contributing

To report bugs or request features or assistance, raise an issue on GitHub.

Licence

MIT License

Copyright (c) 2010-2021 Roy Revelt and other contributors

List of currency signs - Copyright © 2017 Ben Gourley - see its BSD-2-Clause disclaimer

ok codsen star