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

sniffly

v1.0.2

Published

A lightweight TypeScript utility library for performing common type-safe value checks with type narrowing

Readme

👀 Sniffly

Value Checking Utilities for JavaScript

A lightweight TypeScript utility library for performing common type-safe value checks with type narrowing.

Install

npm i sniffly

Functions

iterHasItems( value )

Checks that an iterable is not empty

⚙️ Arguments:

value - object having a length attribute

dictHasEntries( value )

Checks that a dictionary is not empty

⚙️ Arguments:

value - key/value pair dictionnary

isBool( value )

Checks that the value is a boolean

⚙️ Arguments:

value - unknown value to check

isNumber( value, options? )

Checks that the value is a number satisfying optionnal specifications
Remark:
NaN is not considered as a valid number

⚙️ Arguments:

value - unknown value to check
options (dict) - optionnal additionnal specifications
options.positive (boolean) - checks number is > 0
options.min (number) - checks number is >= min
options.max (number) - checks number is <= max

isString( value, options? )

Checks that the value is a string satisfying optionnal specifications

⚙️ Arguments:

value - unknown value to check
options (dict) - optionnal additionnal specifications
options.nonEmpty (boolean) - checks that string is not empty
options.regexPattern (RegExp) - checks that string matches pattern

isArray( value, options? )

Checks that the value is an array satisfying optionnal specifications

⚙️ Arguments:

value - unknown value to check
options (dict) - optionnal additionnal specifications
options.nonEmpty (boolean) - checks that the array has items
options.itemType (string literal) - check type of array's items, following values are accepted:

  • "unknown" (default) - items aren't checked
  • "any" - items aren't checked
  • "string" - string items only
  • "number" - number items only
  • "boolean" - boolean itemps only
  • "array" - Array<unknown> items only
  • "dict" - Record<string, unknown> items only

isDict( value, options? )

Checks that the value is a key/value pair dictionnary satisfying optionnal specifications
Remark:
Only allows objects directly created from {} or Object.create(Object.prototype).
Are considered invalid:

  • Objects built from classes like const obj = new Foo() or built-ins like Array, Map, Set or Date
  • Objects with no prototype like const obj = Object.create(null)

⚙️ Arguments:

value - unknown value to check
options (dict) - optionnal additionnal specifications
options.nonEmpty (boolean) - checks that the dictionnary has entries
options.keys (string array) expected keys that should be present in the dict
options.itemType (string literal) - check type of entries, following values are accepted:

  • "unknown" (default) - entries aren't checked
  • "any" - entries aren't checked
  • "string" - string entries only
  • "number" - number entries only
  • "boolean" - boolean entries only
  • "array" - Array<unknown> entries only
  • "dict" - Record<string, unknown> entries only

Types

Dict_T<EntriesType>

Type of key/value pair dictionnary, with a string key. EntriesType generic represents the type of the entries of the dictionnary.

Example

const data: Dict_T<number> = { 'a': 1, 'b': 2 }