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 🙏

© 2024 – Pkg Stats / Ryan Hefner

justo-inline-assert

v0.2.3

Published

Inline assertions.

Downloads

19

Readme

NPM version Build Status Dependency Status devDependency Status

In-line assertions.

Proudly made with ♥ in Valencia, Spain, EU.

Install

npm install justo-inline-assert

Use

const assert = require("justo-inline-assert");

assert.equal(1, 2); //false
assert.equal(1, 1); //true

Assertions

equal(), eq(), notEqual(), neq() and ne()

Check whether two values are equal:

equal(one, two) : boolean
eq(one, two) : boolean

notEqual(one, two) : boolean
neq(one, two) : boolean
ne(one, two) : boolean

same() and notSame()

Check whether two values are the same:

same(one, two) : boolean
notSame(one, two) : boolean

similar() and notSimilar()

Check whether an array is equal, in any order, to another:

similar(array, another) : boolean
notSimilar(array, another) : boolean

Example:

similar([1, 2, 3], [3, 1, 2])     //true
similar([1, 2, 3], [3, 1, 2, 0])  //false

like() and notLike()

Check whether a value matches a regular expression:

like(value, re) : boolean
notLike(value, re) : boolean

between() and notBetween()

Check whether a value is within a range:

between(value, left, right) : boolean
notBetween(value, left, right) : boolean

greaterThan(), gt(), notGreaterThan() and ngt()

Check whether a value is greater than another:

greaterThan(one, two) : boolean
gt(one, two) : boolean

notGreaterThan(one, two) : boolean
ngt(one, two) : boolean

lessThan(), lt(), notLessThan() and nlt()

Check whether a value is less than another:

lessThan(one, two) : boolean
lt(one, two) : boolean

notLessThan(one, two) : boolean
nlt(one, two) : boolean

contain() and notContain()

Check whether a string or array contains a substring or item, respectively:

contain(col, item) : boolean
notContain(col, item) : boolean

insideOf() and notInsideOf()

Check whether a string or item is within a string or array, respectively:

insideOf(item, col)  : boolean
notInsideOf(item, col) : boolean

have() and notHave()

Check whether an object has a set of properties:

have(object, prop : string) : boolean
have(object, props : string[]) : boolean
have(object, props : object) : boolean

notHave(object, prop : string) : boolean
notHave(object, props : string[]) : boolean
notHave(object, props : object) : boolean

The properties can be defined into the object or its class.

haveAny()

Check whether an object has at least one property of a set:

haveAny(object, props : string[]) : boolean
haveAny(object, object) : boolean

The properties can be defined into the object or its class.

allHave()

Check whether all items of an array have a set of properties:

allHave(array, prop : string) : boolean
allHave(array, props : string[]) : boolean
allHave(array, props : object) : boolean

notAllHave(array, prop : string) : boolean
notAllHave(array, props : string[]) : boolean
notAllHave(array, props : object) : boolean

The properties can be defined into the object or its class.

raise() and notRaise()

Check whether a function throws an exception:

raise(function) : boolean
raise(function, error : string) : boolean
raise(function, error : RegExp) : boolean
raise(function, error : class) : boolean
raise(function, error : object)  : boolean
raise(function, args : object[]) : boolean
raise(function, args : object[], error : string) : boolean
raise(function, args : object[], error : RegExp) : boolean
raise(function, args : object[], error : class) : boolean
raise(function, args : object[], error : object)  : boolean

notRaise(function) : boolean
notRaise(function, error : string) : boolean
notRaise(function, error : RegExp) : boolean
notRaise(function, error : class) : boolean
notRaise(function, error : object)  : boolean
notRaise(function, args : object[]) : boolean
notRaise(function, args : object[], error : string) : boolean
notRaise(function, args : object[], error : RegExp) : boolean
notRaise(function, args : object[], error : class) : boolean
notRaise(function, args : object[], error : object)  : boolean

instanceOf() and notInstanceOf()

Check whether a value is an instance of a specified class/type:

instanceOf(value, class : string) : boolean
instanceOf(value, class : class) : boolean

notInstanceOf(value, class : string) : boolean
notInstanceOf(value, class : class) : boolean