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

@euriklis/validator-ts

v1.0.0

Published

A typescript package for testing and managing of type coonditions.

Readme

@euriklis/validator-ts

A versatile TypeScript library for conditional analysis, testing, and validation of JavaScript/TypeScript types.

Installation

You can install the @euriklis/validator-ts package using npm:

npm install @euriklis/validator-ts

Alternatively, you can install a specific version using the --save-exact flag:

npm install @euriklis/validator-ts@<version> --save-exact

This command will add the package to your node_modules folder.

Usage

The @euriklis/validator-ts library is designed for conditional testing, allowing you to create complex compositions of checking criteria and obtain the logical results of these tests. For example, if you have a user, a registration protocol, and a database, you can use the validator to test if the registration criteria are fulfilled:

const user = {
    username: 'Harris',
    password: 'k12d87dc3A!43d',
    email: '[email protected]',
    age: 22
};

const users = DB.getUsers();
const has_payment = true;

new validator(user)
    .interface({
        username: usr => usr.isString.and.hasLengthEqualsOrGreaterThan(6),
        password: psw => psw.isString.and.hasLengthGreaterThan(6),
        email: mail => mail.isString.and.isEmail,
        age: age => age.isEqualOrGreaterThan(18)
    })
    .and.bind(new validator(user.not.isSameWithAny(users)))
    .and.bind(new validator(has_payment).isSame(true))
    .on(true, () => makeRegistration(user))
    .on(false, () => requireInfo(users, user, has_payment));

You can use methods like isInteger, isArray, isNumber, isString, isObject, isUndefined, isEmpty, and more without parentheses. Additionally you may use the operators and, or, and not. For example:

import validator from '@euriklis/validator-ts';

const array: number[] = [1, 2, 3, 4, 5, 8, 12];

new validator(array)
    .isIntegerArray
    .or.isStringArray
    .on(true, () => console.log('The array contains only integers or strings.'));

Because of the fact that the package uses private methods, please note that private methods require Node.js version 12.0.0 or higher, Chrome version 74 or higher, and Firefox version 90 or higher.

Methods

The most of the methods of the @euriklis/validator-ts return a validator instance, allowing you to chain methods. The result of the comparison (the answer) and the condition fulfillment are recorded in the "answer" property. Here's an example:

import validator from '@euriklis/validator-ts';

let a:number = 5, b:number = 12, c:number | string[] = [11, 13];

let result = new validator(a)
    .isInteger
    .and.isLessThan(6).or.isInClosedRange(5, 6)
    .and.bind(
        new validator(b).isInteger.and
            .isGreaterThan(10)
    )
    .and.bind(
        new validator(c).isNumberArray
            .and.not.forAny(number => {
                return number.isFloat();
            })
    )
    .answer;

console.log(result); // true

Bugs and Tips

If you encounter any issues or have tips to share, please feel free to contact us. You can reach us or to publish your suggestion in the issues section of the github repo of the package.

License

The @euriklis/validator-ts package is released under the MIT License. It is provided for free for personal and non-commercial use. The author of the package is not liable for errors in third-party software, libraries, packages, or source code used in conjunction with this library.