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

ormon

v0.3.2

Published

Ormon

Readme

Ormon

Object ~Relation~ Document Mapper for Mongodb

Quick Start

// import ormon
const { OrmonEngine, OrmonModel, MongoDriver } = require("ormon")

// connect to the database
OrmonEngine.init(new MongoDriver("mongodb://localhost:27017/db"))

// Create a model
class Post extends OrmonModel {}

// Bind the model to a collection
OrmonEngine.bind("posts", Post)

await Promise.all([
  // We're talking about mongo, you can initilize your object with anything ;)
  (new Post({title: "first", body: "My first article"})).save(), // Call save to save, duh.
  (new Post({title: "second", body: "My second article"})).save(),
  (new Post({title: "third", body: "My third article"})).save(),
])

// Retrieve the 1st post
const first = await Post.findOne({title: "first"})

console.log(first.$state.body) // My second article
//                ^-------------- You can access any property from the state

// Deletes the post
await first.delete()

// list only articles with a `t` in the title
const articles = await Post.findMany({title: /t/}, null, d => d.format())
// do not apply any sort / limit filters -----------^           ^-------- do convert each document into clean obj

console.log(articles) // [{title: "third", body: "My third article", id: "349080932840"}]

// Save handles update as well
articles[0].$state.title = "first"
await articles[0].save()

const articles = await Post.findMany({title: /t/}, null, d => d.format())
console.log(articles) // [{title: "first", body: "My third article", id: "349080932840"}]

Not just for storing...

The point of having a class that acts as a model is that one can extends its behavior:

const { OrmonEngine, OrmonModel } = require("ormon")

class User extends OrmonModel {
  /** Sets the password of the user and hashes it
   *
   *  @param {String} data The password to hash
   */
  set password(data) { this.$state.password = sha384(data) }

  /** Checks if the provided password matches the user's
   *
   *  @param {String} password The password to test
   *  @return {Boolean} Whether both password matched
   */
  authenticate(password) { return this.$state.password === sha384(password) }
}

OrmonEngine.bind("users", User)

const user = await User.findOne({username: req.body.username })
if (!user || !user.authenticate(req.body.password))
  return res.status(401).json({code: "Unauthorized", message: "We don't know who you are!"})

Contributing

Pre-requisits

One needs docker and docker-compose + the right to run commands as current user. Mostly (actually only) for test purposes

Yarn commands

  • test: Runs unit tests and cover (actually runs docker with mongo and then runs tests)
    • test:docker: Tests runs within the docker container
    • test:ci: Runs test and report coverage to codecov
  • lint: Runs eslint (yarn lint --fix to fix some errors)
  • doc: Generates the documentation