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 🙏

© 2026 – Pkg Stats / Ryan Hefner

cron-js-wasm

v0.0.2

Published

Cron parser WASM library

Readme

cron-js-wasm

Cron parser WASM library for Node.js and browsers, powered by TinyGo.

Installation

pnpm add cron-js-wasm

Usage

import { init, Cron } from "cron-js-wasm";

// Initialize WASM module first
await init();

// Create a cron instance with a single spec
const cron = new Cron("0 7 * * 1-5");

// Or with multiple specs as an array
const cron = new Cron(["0 7 * * 1-5", "0 9 * * 6"]);

// Add more specs later
cron.add("0 12 * * *");

// Get next occurrence
const next = cron.next();

// Get previous occurrence
const prev = cron.prev();

// Get next N occurrences
const nextThree = cron.nextN(3);

// Get previous N occurrences
const prevThree = cron.prevN(3);

// Get next occurrence from a specific time
const nextFromDate = cron.next(new Date("2025-01-01"));

Browser Usage

The package automatically uses the browser entry point when bundled with Vite, Webpack, esbuild, etc.

import { init, Cron } from "cron-js-wasm";

// Initialize - automatically loads WASM from jsDelivr CDN
await init();

const cron = new Cron("0 7 * * 1-5");
console.log(cron.next());

To use a custom WASM URL (e.g., self-hosted):

await init("/wasm/module.wasm");

Self-hosting the WASM file

Copy the WASM file from node_modules to your public directory during build:

Vite

// vite.config.ts
import { defineConfig } from "vite";
import { viteStaticCopy } from "vite-plugin-static-copy";

export default defineConfig({
  plugins: [
    viteStaticCopy({
      targets: [
        {
          src: "node_modules/cron-js-wasm/wasm/module.wasm",
          dest: "wasm",
        },
      ],
    }),
  ],
});

Manual / npm script

{
  "scripts": {
    "copy:wasm": "cp node_modules/cron-js-wasm/wasm/module.wasm public/wasm/"
  }
}

Then initialize with your hosted path:

import { init, Cron } from "cron-js-wasm";

await init("/wasm/module.wasm");

API

init(wasmUrl?: string): Promise<void>

Initialize the WASM module. Must be called before creating Cron instances.

  • Node.js: No arguments needed, loads from the package's wasm directory
  • Browser: No arguments needed, loads from jsDelivr CDN. Pass a custom URL to self-host.

new Cron(specs: string | string[])

Create a new Cron instance with one or more cron specifications.

cron.add(spec: string): Cron

Add a cron specification to the instance. Returns this for chaining.

cron.next(time?: Date): Date

Get the next occurrence after the given time (defaults to now).

cron.prev(time?: Date): Date

Get the previous occurrence before the given time (defaults to now).

cron.nextN(n: number, time?: Date): Date[]

Get the next N occurrences after the given time.

cron.prevN(n: number, time?: Date): Date[]

Get the previous N occurrences before the given time.

Building

Requires TinyGo to build the WASM module.

# Build WASM module
pnpm build:wasm

# Build TypeScript
pnpm build