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

object-match-statement

v1.0.4

Published

Builds string, that contains compare statement of two objects

Readme

object-match-statement

Generates if one-liner, that returns true, if left object is subset of right object.

Usage

var Matcher = require('object-match-statement');

console.log(Matcher.build('obj', { a: 1, b: 1})); // -> 'obj.a === 1 && obj.b === 1'

API

Matcher.compile(object)

Returns compiled function, that acceps object and returns Boolean, indicates, that passed object is matching compiled pattern.

Matcher.build(prefix, object)

Returns one-line if for comparsion other objects agains object param. Prefix used to identify compared object inside generated if.

Mathcer.escape(id)

Returns escaped property accessor. For example for valid will be returned .valid, but for -invalid will be returned ["-invalid"].

Benchmarks

object-match-statement is using if for patterns, since inlining is not an option (we need to construct comparing statement by object fields and values).

                     simple object
     164,427,234 op/s » inline#simple_match
     101,336,062 op/s » inline#simple_mismatch
     100,053,487 op/s » if#simple_match
      75,304,293 op/s » if#simple_mismatch
      87,757,658 op/s » swtch#simple_match
      68,066,432 op/s » swtch#simple_mismatch
      89,974,169 op/s » recursive#simple_match
      22,123,933 op/s » recursive#simple_mismatch

                      complex object
     123,443,614 op/s » inline#complex_match
     123,150,712 op/s » inline#complex_mismatch
      87,888,269 op/s » oms#complex_match
      82,031,672 op/s » oms#complex_mismatch
      71,166,844 op/s » swtch#complex_match
      69,140,028 op/s » swtch#complex_mismatch
      79,993,904 op/s » recursive#complex_match
      21,916,098 op/s » recursive#complex_mismatch

License

MIT (c) Vsevolod Strukchinsky