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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@mrnicericee/verify

v1.1.2

Published

my simple verify project

Downloads

4

Readme

Verify

This is a project started because I wanted a way to streamline error checking & throwing a custom error with built in html status codes. In a way where it can be chained

// example
const target = 'string'
Verify(target).isString()
Verify(target).isNumber() // will throw an ErrorException. 
/* ErrorException:
    message: 'string must be a number',
    statusCode: 400,
*/

Features

Checks done by Verify

  • Base Check
    • isDefined - null/undefined
  • Types
    • isString
    • isNumber
    • isInt
    • isBoolean
    • isArray
  • Comparison
    • isEquals ===
    • isGT >
    • isGTE >=
    • isLT <
    • isLTE <=
  • ErrorException
    • standard error messages per type/comparison Check
    • default 400 statusCode (can be changed)

Example

import Verify from 'verify';

checking for a number & the properties in Verify

const numberVerify = Verify('1', { name: 'number test' }).isNumber();
const { value, type, error, failed, steps, verifiedNumber, compared } = numberVerify;
// value = 'string'
// type = 'string'
// error = false
// failed = false
// steps = func
// steps('isDefined') = true
// steps('isString') = true
// steps() = Map(2) { 'isDefined' => true, 'isString' => true }
// verifiedNumber = BigJS -> changes when .isNumber() is chained
// compare = null -> will change when a comparison is chained
numberVerify.isGT(0);
// steps() = Map(3) { 'isDefined' => true, 'isNumber' => true, 'isGT' => true }
// compare = 0
numberVerify.isLTE(0); // throws an ErrorException
/* ErrorException:
    message: number test must be <= 0
    statusCode: 400
*/

Documentation

let's walk through the app!
all of the options are -- optional :)

Initial

Verify(value, options)

value: any = object to be verified
options: object = initial options for Verify

options = {
  soft: boolean,
  missing: string,
  status: number,
  name: string,
}

soft - will not throw an error

  • for the cases when you do want to check or maybe debug
  • the error, failed booleans & steps function will come in handy! missing - when value evaluates as null/undefined, this will be the error message \
  • by default it is "missing value" status - html error code MDN, GO
    name - if you want to name the value, by default it will be the value itself

TypeCheck

Verify()
    .isNumber(options)
    .isInt(options)
    .isString(options)
    .isBoolean(options)
    .isArray(options)

for these options it will affect the typecheck chaining

options = {
    message: string,
    status: number,
}

message - this will be the error message

  • by default it is "value must be a(n) type" status - this will be the HTML error status code

Comparison

note, isEquals does not support deep array or object comparisons (yet, maybe).
this is a VERY basic equals.

-- chain
  .isEquals(compare, options)

must have isNumber() chained prior to use these.
leverages BigJs

-- chain
  .isGT(compare, options)
  .isGTE(compare, options)
  .isLT(compare, options)
  .isLTE(compare, options)

compare - object to compare against value

options = {
    message: string,
    status: number,
    compareName: string,
}

message - this will be the error message

  • by default it is "value must be operator type"
  • operator could be >, >=, <, <= status - this will be the HTML error status code
    compareName - name of the compare object

Feedback

If you have any feedback, please reach out to to [email protected]

License

MIT