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

@jonloucks/contracts-ts

v1.2.2

Published

Typescript Dependency Contracts for dependency inversion

Readme

@jonloucks/contracts-ts

Badges

CI npm version Coverage Badge Typedoc Badge

Typescript Dependency Contracts for dependency inversion

Documentation

Installation

npm install @jonloucks/contracts-ts

Usage - code fragments from Example.test.ts

import { CONTRACTS, createContract } from '@jonloucks/contracts-ts';
import {
  AutoClose,
  bind,
  claim,
  Contract,
  createExtractor,
  createLifeCycle,
  createRepository,
  createSingleton,
  createValue,
  createContract,
  enforce,
  guardFunctions,
  isBound
} from "@jonloucks/contracts-ts/api/Convenience";
// Define a service interface
interface Logger {
    log(message: string): void;
}

// Create a contract for the service
const LOGGER_CONTRACT: Contract<Logger> = createContract<Logger>({
    name: "Logger",
    test: (obj: unknown): obj is Logger => { // example of duck-typing check
    return guardFunctions(obj, 'log'); // example of using guardFunctions helper
    }
});

bind<Logger>(LOGGER_CONTRACT,
    createSingleton<Logger>(
        () => ({
            log: (message: string) => {
                console.log("LOG:", message);
            }
        })));
const logger : Logger = enforce<Logger>(LOGGER_CONTRACT);
logger.log("Using the service in the test.");

Development

npm install
npm run build
npm test
npm run test:watch
npm run test:coverage
npm run lint
npm run lint:fix
npm run docs
npm run badges
  • All tests must have suffix of -test.ts or -spec.ts
  • Tests that validate supported APIs go in src/test
  • Tests that validate internal implementation details go in src/impl
contracts-ts
├── .github
│   ├── ISSUE_TEMPLATE
│   │   ├── bug_report.md
│   │   └── feature_request.md
│   └── workflows
│       ├── main-pull-request-matrix.yml
│       ├── main-pull-request.yml
│       ├── main-push.yml
│       └── main-release.yml
├── CODE_OF_CONDUCT.md
├── CODING_STANDARDS.md
├── CONTRIBUTING.md
├── editorconfig
├── eslint.config.mjs
├── jest.config.js
├── LICENSE
├── package-lock.json
├── package.json
├── PULL_REQUEST_TEMPLATE.md
├── README.md
├── scripts
│   ├── badge-template.svg.dat
│   └── tsconfig.json
├── SECURITY.md
├── src
│   ├── index.ts
│   ├── version.ts
│   ├── api
│   │   ├── *.ts
│   │   ├── *.api.ts
│   ├── auxiliary
│   │   ├── *.ts
│   │   ├── *.impl.ts
│   │   ├── *.test.ts    // internal implementation specific
│   │   └── *.api.ts
│   ├── impl
│   │   ├── *.ts
│   │   ├── *.impl.ts
│   │   ├── *.test.ts    // internal implementation specific
│   │   └── *.api.ts
│   ├── test
│   │   └── *.test.ts
│   └── never-publish             // non shippable development scripts
│       ├── *.ts
│       ├── *.*.                  // data files etc
│       └── *.test.ts
├── tsconfig.json
└── typedoc.json

GitHub Workflows

The CI workflow runs on every push and pull request to main branch. It:

  • Tests against Node.js versions 18.x, 20.x, 22.x, and 24.x
  • Runs linting
  • Builds the project
  • Runs tests with coverage
  • Uploads coverage to Codecov (optional)

The GitHub publishings workflows are run to make an official release.

  • If all scanning and tests pass it is published. There is no other way allowed.
  • Publishing authentication is done using (OIDC trusted publishing)

To set up your own publishing:

  1. Publishing this project as is intentionally disabled
  2. You are welcome to fork this repository and publish where you want.
  3. Run npm pkg delete private to remove the private flag from the package.
  4. Change the name field in package.json to your desired package name.

License

MIT