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

gcomply

v0.3.1

Published

Lightweight automatic grammar agreement (AGA) for JavaScript/TypeScript

Downloads

77

Readme

`Add ${count} person to group.`       
// ❌ "Add 2 person to group."

g`Add ${count} person to group.`
// ✅ "Add 2 people to group."

[!WARNING] Experimental: This is an experimental JavaScript API for automatic grammar agreement, modeled after the equivalent Swift API.

🚀 Mission

  • What it is: A lightweight engine for automatic grammar agreement – scoped specifically for human interfaces in software products. Provide fast, automatic grammar agreement to cover ~99% of real-world cases. Take the edge-case handling out of UI.

  • What it is NOT: Perfect or feature-complete grammar correction, stemming/lemmatization, lexical analysis, or sentiment analysis. This package will never

Intl.MessageFormat provides manual support for plural/selects. But it is entirely manual, and up to developers to predict all variance. It's also very challenging to correctly translate any string where a parameter (i.e. a noun) is interpolated.

Example:

const notification = t("I was in {country}")
// German: "Ich war in {country}"

const switzerland = t("Switzerland")
// German: "die Schweiz"

notification.format({ country: switzerland })
// "Ich war in die Schweiz" ❌

// The feminine dative article is "der" (not 
// "die") so it should instead be:
// "Ich war in der Schweiz" ✅

In this example if you supported 180+ countries, you might have a much bigger problem.

So to summarize, ICU MessageFormat is a great tool, but its focused primarily on a different problem.

Add plurals

import { Grammar, Plurals } from "gcomply";

Plurals.getLang("en").addTagged(Grammar.PartOfSpeech.noun,
  { one: "sausage", other: "sausages" },
  { one: "twist", other: "twists" },
);

✨ Features

  • ⚡️ Instant grammar agreement — plurals, gender, articles, etc.
  • 📦 Highly pluggable — compatible with any other framework
  • 🌐 Localizable — add support for any natural language
  • 🪶 Lightweight — <5kB, zero dependencies

Add custom transforms, domain terminology, nouns, pronouns, and more.

API Usage

Simple usage

  • Syntax: g``

The g tagged template will coerce inline grammar (in accordance to any global options).

import { g } from "gcomply";

let views = content.viewCount,
    shares = content.shareCount

let text = g`${views} new views, ${shares} new shares`
// "35 new views, 1 new share"

Complex grammar

  • Syntax: inflect(text, options?)

The inflect() function provides a little more flexibility for complex grammatical agreement, and may also be passed additional external options:

import { inflect } from "gcomply";

let text = "Votre conseiller est prêt."

let opts = {
    language: "fr",
    morphology: { grammaticalGender: "feminine" }
}

inflect(text)        // "Votre conseiller est prêt."
inflect(text, opts)  // "Votre conseillère est prête."

[!NOTE] Terminology:

Parts of the API terminology is modeled to be consistent with the emerging equivalent Swift APIs for morphology and inflection.

Notably though, there is no direct proxy for Swift's AttributedString in JavaScript.

Implementation status

These are the Swift agreement features:

| Status | Agreement Type | Methodology | Code Changes | Description | --- | ---------------------- | ----------------------- | ------------ | --- | partial | inflect | Proximity-based | No | Reference neighboring elements. | ❌ | agreeWithArgument | Explicit reference, same string | No | Directly reference other elements in the strings. | ❌ | agreeWithConcept | Explicit reference, injected | Yes | Agree with a Concept passed in via context.

[!NOTE] Source: See WWDC2023 @ 6:15

🛠️ Contributing

Contributions are welcome, such as:

  • New language packs
  • More granular inflection rules
  • Bug fixes and test cases
  • Integrations for other frameworks or i18n tools

[!Important] Keep in mind, the goal of this package is not to provide perfect and comprehensive language support that covers all possible permutations out-of-the-box.