npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

parse-ynab-export

v1.0.6

Published

Convert the YNAB tsv export files to an easy-to-use data structure

Downloads

16

Readme

This module will help you convert YNAB's register and budget tsv files to an easy to use data structure.

Install

npm install -g parse-ynab-export

Usage

import { parse } from "parse-ynab-export";

// This data is the same format as you get from the 2 files in the YNAB export zip
const budgetData = `"Month"	"Category Group/Category"	"Category Group"	"Category"	"Budgeted"	"Activity"	"Available"
"Jun 2019"	"Essential Expenses: Groceries"	"Essential Expenses"	"🍲 Groceries"	€144,36	-€197,44	€0,00
"Jul 2019"	"Essential Expenses: 🍲 Groceries"	"Essential Expenses"	"🍲 Groceries"	€150,00	-€11,51	€138,49`;
const registerData = `"Account"	"Flag"	"Date"	"Payee"	"Category Group/Category"	"Category Group"	"Category"	"Memo"	"Outflow"	"Inflow"	"Cleared"
"💵 Checking"	""	"02/07/2019"	"Hetzner"	"Software Subscriptions: Hetzner"	"Software Subscriptions"	"Hetzner"	""	kr 30,00	kr 0,00	"Uncleared"
"💵 Checking"	""	"22/06/2019"	"Spotify"	"Software Subscriptions: Spotify"	"Software Subscriptions"	"Spotify"	"Split (1/2) "	kr 84,50	kr 0,00	"Uncleared"
"💵 Checking"	""	"22/06/2019"	"Transfer : Splitwise Papa"	""	""	""	"Split (2/2) Spotify"	kr 84,50	kr 0,00	"Uncleared"
"💰 Buffer"	""	"27/02/2019"	"Transfer : 💵 Checking"	""	""	""	"Transfer to buffer from checking"	kr 0,00	kr 1234,44	"Reconciled"`;

parse(budgetData, registerData);

This returns an object of type YnabData. (see below for info on the types)

Object {
	budget: (2) […], // All the budget lines (for each year/month and category)
	register: (3) […], // All the transaction lines
	accounts: (2) […], // All the accounts used in the transaction (register) lines
	registerByAccount: {…}, // Register lines grouped by account. (key = account name, value = RegisterLine[])
	categoryHierarchy: Map(2), // A hierarchy of the category groups and categories (key = category group name, value = array of category names)
	categories: (3) […],
	categoryGroups: (2) […]
}

Interfaces

YnabData interface

interface YnabData {
	budget: BudgetLine[];
	register: RegisterLine[];
	accounts: string[];
	registerByAccount: { [key: string]: RegisterLine[] };
	categoryHierarchy: Map<string, Set<string>>;
	categories: string[];
	categoryGroups: string[];
}

Budget lines

interface BudgetLine {
	month: moment.Moment;
	categoryAndGroup: string;
	categoryGroup: string;
	category: string;
	budgeted: number;
	activity: number;
	available: number;
}

Register lines

The register lines are split up in to 3 interfaces.

  • Regular transaction
  • A transfer from 1 account to an other
  • A split, when a transaction is split up into multiple categories
    These splits are bundled up into 1 "split" line with a property "splits" that contains the corresponding split lines.

See register line interfaces here.