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

@dillonchr/bankrupt

v2.0.2

Published

module for keeping track of paychecks and budgets

Downloads

1

Readme

Bankrupt

A paycheck and budget balancer

Instal

npm i @dillonchr/bankrupt

Overview

This module is built to keep track of how much your paycheck was. What you're spending out of it. How much you allocate for your personal budget. And how much of your personal budget you've spent. When you get paid again you can reset your paycheck and keep the budget leftovers in your next budget. If you create a budget deficit, then that's on you. I don't track those because I like buying stuff.

Environment

  • BANKRUPT_DIRNAME - path to store register.json config file
  • BANKRUPT_DEFAULT_PAYCHECK_AMOUNT - float - the default amount of each paycheck

Usage

You can get balance, spend, and reset.

balance(id)

This will fetch the current balance for the account whose id matches

spend(id, amount)

This will update the account whose id matches to have balance - amount as its new balance. This will write changes to disk after 60 seconds.

reset(id, amount=BANKRUPT_DEFAULT_PAYCHECK_AMOUNT)

This will reset the account whose id matches to have a fresh balance.

This will check the register to see if there is a corresponding linking-budget-${id} configuration. If there is a configuration, it will be structured like this:

{
  "cut": 100,
  "ids": ["0001234","0005678"],
}

And this will then cycle through the associated ids to reset their balance too. First it will check the current balance for the paycheck, the original id, then divide any positive number by 0.1 and give each linked budget id a little bonus from the leftovers. Then it takes the cut and divides by the number of ids present and sets that as the minimum balance of the budget id. It goes over each id in the array and checks if there's a positive balance and then sums the min with the current balance. Otherwise it just sets the account's balance to the minimum balance.

Changes

Starting with 2.0.0, I wanted to get rid of mongodb. So this is an attempt to simplify this module and hopefully make it a little easier to work with. So this is a major release because the paycheck and budget submodules have been removed completely. Now it's best to just think of this module as a simple calculator.

The way kowalski works with this now, is it uses the paycheck channel ID for the paycheck balance/spend/reset. And it uses author.userId as the budget ID. So we can keep everything in one config file and even roll out changes via updating the config file.