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

jsinspector-js

v1.0.0

Published

Javascript package for data validation, allow javascript developers to validate the application incoming data with a variety of validation rules.

Readme

Js-Inspector

# Install via npm

npm i jsinspector-js

# Example

// Import package
const JsInspector = require('jsinspector-js')

// Create new instance from JsInspector
const inspect = new JsInspector()

// Add your validation rules
inspect.data('ahmed')
       .field('username')
       .alpha()
       .required()

inspect.data('[email protected]')
       .field('email')
       .email()
       .required()

inspect.data('12345678')
       .field('password')
       .max(30).min(8)
       .required()

// Check whether the validation process is successful or not
if(inspect.valid()){
   // (true - success) the data is valid
} else {
   // (false - fail) the data is not valid

   // Display errors
   console.log(inspect.errors())
}

# Available Validation Rules

required()

The data must be not empty and it considered empty if the value is null or empty string or array.

numeric()

Should only contain whole numbers (0,1,2,3..) without negative, fractions or decimals.

integer()

Should only contain integer numbers that can be positive, negative, or zero.

email()

Must be a valid email address.

decimal()

The data under validation must be numeric contains whole and a fractional.

alpha()

The data must contain only alphabetic characters (letters).

alphas()

Similar to alpha() but accepts spaces (letters, spaces).

alnum()

The value must contain only alphanumeric characters (letters, numbers).

alnums()

Similar to alnum() but accepts spaces (letters, numbers, spaces).

url()

Must be a valid URL.

date()

Must be a valid date corresponding to this format ☛ (yyyy-mm-dd).

max() min()

max() The field under validation must be less than or equal to a maximum value.

min() The field under validation must have a minimum value.

pattern()

This method allows you to write your own Regex pattern.

// Example
const inspect = new JsInspector()

inspect.data('ahmed').field('fieldname').pattern(/^[A-Za-z ]*$/)

match()

The data should match the given value. this rule usually used to confirm the password.

// Example
const inspect = new JsInspector()

inspect.data('1d23').match('1d23')

# Other Methods

errors()

This method returns error messages as an object.

// Example
const inspect = new JsInspector()

inspect.data('hello').email().required()

/** Display errors **/
console.log(inspect.errors())

show()

Displays the error message within a specific element. It takes one parameter the element (id).

<!-- element with ID to display incoming errors -->
<p id="error-msg"></p>
// Js Example
const inspect = new JsInspector()

inspect.data('hello').email().required().show('error-msg')

valid()

Check whether the validation process is successful or not. This method return boolean (ture) for success (false) for fail.

// Example
const inspect = new JsInspector()

inspect.data('notvalidemail').email().required()

if(inspect.valid()){
   // (true) success
} else {
   // (false) fail
}

data()

Determine the data to be validated. It takes one parameter (data)

data('value') // @param mixed, (data)

field()

Determine the field name.. The class uses the value in this method for error messages, so it's very important to specify to get meaningful error messages.

It takes one parameter (fieldname)

field('username') // @param string, (input name)