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 🙏

© 2025 – Pkg Stats / Ryan Hefner

recurrentry

v2.1.3

Published

A simple and easy-to-use library for recurring entries.

Readme

🌀 recurrentry

TypeScript Coverage

[!CAUTION] This is a work in progress and the API is not stable yet. Don't use it in production.

A highly opinionated TypeScript library for handling recurring payments with precision and flexibility.

I built this library to help me manage my personal finances and automate recurring payments for my income & expense trackking app gider.im.

🚀 Key Features

Payment Scheduling

  • ✨ Single and recurring payments (single, weekly, monthly, yearly)
  • 🔄 Support for payment modifications (edit, delete)
  • 💼 Business day adjustments (weekends/holidays)
  • ⏰ Grace period support for payment due dates
  • 📆 Day-level precision using Temporal API
  • 🛡️ Type-safe configuration with TypeScript

Advanced Payment Rules

  • 🔢 Flexible payment intervals (every X weeks/months/years)
  • 📅 Ordinal day specifications:
    • first-monday, last-friday, first-weekday, last-weekend
    • Supports all combinations of:
      • Position: first, second, third, fourth, fifth, last, nextToLast
      • Type: day, weekday, weekend, or specific day (monday-sunday)
  • 📅 Weekly payment features:
    • Specify days of the week (1-7, where 1 is Monday)
    • Skip weeks with the "every" parameter (e.g., bi-weekly payments)
    • Set specific payment days within each week

Modifications for Recurring Payments

  • ✏️ Edit amount, date for recurring payments
  • 🗑️ Delete single or future occurrences
  • 📝 Apply changes to future payments
  • Single payments are not modified, they are as is (you need to modify them manually)

🗓️ Date Handling

The library operates with day-level precision using the Temporal API:

  • Uses Temporal.PlainDate for all date operations
  • Helper function createDate() provided for easy date creation

📦 Installation

pnpm install recurrentry
# or
bun install recurrentry
# or
npm install recurrentry
# or
yarn add recurrentry

🎯 Quick Example

const data = [
  {
    id: 1,
    name: "Single Payment",
    amount: "100.00",
    type: "income",
    date: createDate("2024-01-01"),
    config: {
      period: PERIOD.NONE,
      start: createDate("2024-01-01"),
      interval: 1,
    } satisfies SinglePayment,
  },
  {
    id: 3,
    name: "Weekly Income",
    amount: "255.00",
    type: "income",
    date: createDate("2024-01-01"),
    config: {
      period: PERIOD.WEEK,
      start: createDate("2024-01-01"),
      interval: 5,
      options: {
        every: 1,
        workdaysOnly: "next",
      },
    } satisfies WeeklyPayment,
  },
  {
    id: 4,
    name: "Credit Card",
    amount: "1000.00",
    type: "expense",
    date: createDate("2024-01-01"),
    config: {
      period: PERIOD.MONTH,
      start: createDate("2024-01-01"),
      interval: 5,
      options: {
        every: 1,
        workdaysOnly: "next",
        gracePeriod: 10,
      },
    } satisfies MonthlyPayment,
  },
];

// Let's generate the payments
const result = generator({
  data,
  modifications: [
    {
      itemId: 3,
      index: 2,
      payload: {
        amount: "411.00",
      },
      restPayload: {
        amount: "300.00",
      },
    },
    {
      itemId: 3,
      index: 4,
      payload: {
        amount: "555.12",
      },
    },
    {
      itemId: 4,
      index: 3,
      payload: {
        date: createDate("2024-03-15"),
        amount: "6087.22",
      },
    },
  ],
  weekendDays: [6, 7], // Saturday and Sunday
  holidays: [createDate("2024-01-01")], // New Year's Day
});

🟰 Example Generator Result

| # | index | name | amount | period | occurrence date | payment date | | --- | ----- | -------------- | ------: | :-----: | --------------- | ------------ | | 1 | | Single Payment | 100.00 | none | 2024-01-01 | 2024-01-01 | | | | | | | | | | 3 | 1 | Weekly Income | 255.00 | week | 2024-01-01 | 2024-01-02 | | 3 | 2 | Weekly Income | 411.00 | week | 2024-01-08 | 2024-01-08 | | 3 | 3 | Weekly Income | 300.00 | week | 2024-01-15 | 2024-01-15 | | 3 | 4 | Weekly Income | 555.12 | week | 2024-01-22 | 2024-01-22 | | 3 | 5 | Weekly Income | 300.00 | week | 2024-01-29 | 2024-01-29 | | | | | | | | | | 4 | 1 | Credit Card | 1000.00 | month | 2024-01-01 | 2024-01-11 | | 4 | 2 | Credit Card | 1000.00 | month | 2024-02-01 | 2024-02-12 | | 4 | 3 | Credit Card | 6087.22 | month | 2024-03-15 | 2024-03-15 | | 4 | 4 | Credit Card | 1000.00 | month | 2024-04-01 | 2024-04-11 | | 4 | 5 | Credit Card | 1000.00 | month | 2024-05-01 | 2024-05-13 |

🤝 Contributing

  1. Fork the repository
  2. Create a new branch for your changes
  3. Make your changes and write tests if applicable
  4. Submit a pull request

📄 License

Licensed under the MIT License.