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

it-is

v1.0.3

Published

terse functional assertion framework

Readme

#It-Is#

a terse assertion DSL, inheriting from node's assert module, but enhanced with the power of functional programming & colours!

Basic Usage#

var it = require('it-is')

it(actual).equal(10)

High-level Usuage

every applies an assertion function to every item in a list.

it(arrayOfNumbers)
  .every(it.typeof('number'))

has applies assertion functions to leaves of a tree.

it({a:1, b: 3})
  .has({
    a: it.typeof('number').notEqual(3)
  , b: it.equal(3)
  })

huh?

if you call it with an argument it(actual) assertions chained will be applied immediately.

it(actual).equal(expected) 

is that same as

assert.equal(actual,expected)

if you don't provide an argument, but just start chaining it.equal(expected), it returns a function which makes that assertion.

it.typeof('number').notEqual(unexpected)

returns a function like this:

function (actual){
  assert.typeof(actual,'number') //not in node's assert. added in it-is
  assert.notEqual(actual,unexpected)
}

pass these functions into It-Is's every and has for terse assertion easyness!

then glance at the error messages which are highlighted to show the exact point the assertion failed:

#Assertion Methods#

node's assert module methods:

ok,equal,notEqual,deepEqual,notDeepEqual,strictEqual,notStrictEqual,throws,doesNotThrow,ifError

and also:

##typeof## assert type, expected can be 'string', 'number', 'boolean', 'object', 'function', or 'undefined'

it(actual).typeof(type)

##instanceof## assert instanceof, expected should be a constructor function

it(actual).instanceof(constructor) 

example:

it([]).instanceof(Array)

##primitive## assert is not an object or a function

it(7).primitive()

##complex## assert is an object or a function

it({}).complex()

##function## assert is a function

it(function(){}).function()

##matches## assert matches a regular expresson

it(actual).matches(regex)

example:

it('[email protected]').matches(/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/)

##like## assert two strings match, but ignoring case, white space and whether quotes are " or '. (is configurable)

it(actual).like(expected, options)

options object is optional! but should be this format:

{case: boolean,whitespace: boolean, quotes: boolean}

##every##

apply assertions to every item in an array

it(array).every(assertion)

example:

it([1,2,3,4,5]).every(it.typeof('number').notEqual(0))

assertion is just a function

it([
  [1,1.0]
, [1,1e0]
, [1,7/7]
]).every(function (line){
  assert.equal(line[0],line[1])
})
  

##property##

apply check that it has a property and apply an assertion

it(actual).property(name,value) //checks that actual[name] == value

or if value is a function:

it(actual).property(name,assertion) //checks that assertion(actual[name])

example:

it([]).property('length',0)

it({a: /sdf/}).property('a',it.instanceof(RegExp))

##has##

apply asssertions to properties of an object, checking that properties and actually there first.

it(actual).has(properties)

if a property is primitive, it's checked for equality. if a property is a function, it's called with actual's corrisponding property as the argument.

example:

it({
    a: 1
  , b: 2
  , c: { x: true }
  , d: [1,2,3,4,5,true,'string'] 
  })
  .has({
    a: it.notEqual(0)
  , b: 2 //values are treated like it.equal(value)
  , c: it.complex()
  , d: it.every(it.primitive())
  })

enjoy!

next, implement and document how to add assertion functions and renderers and render styles.