Package Exports
- validatees
- validatees/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (validatees) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
validatees
Validation package for ES6+, TypeScript and JavaScript(CommonJS and Module) ready.
Features
- 🚀Easy to use: Easy to install in your project.
- ✅ES6+ && TS: TypeScript and ES6+ support(JS).
- 🐭Small footprint: Less then 3kb package size.
- 📦No dependencies: You don't depend on anything else.
Getting Started
Installation
To use this package, install using npm
, yarn
or pnpm
📥:
# npm
npm install validatees
# yarn
yarn add validatees
# pnpm
pnpm add validatees
Usage
// ES6+ JavaScript CommonsJs
const validatees = require("validatees");
// TypeScript || ES6+ JavaScript module
import validatees from "validatees";
Types
Type checking can be difficult, but with validatees
types, it's easy.
isFalsy:
Made from 'Falsy MDN defenition'.
const { isFalsy } = require("validatees");
isFalsy(0); // true
isFalsy(1); // false
isFalsyExtended:
Made from 'Falsy MDN defenition'. Also includes Array and object checking.
const { isFalsyExtended } = require("validatees");
isFalsyExtended(1); // false
isFalsyExtended(0); // true
isFalsyExtended([]); // true
isFalsyExtended({}); // true
isTruthy:
Everything not falsy is truthy. Made from 'Truthy MDN defenition'
const { isTruthy } = require("validatees");
isTruthy(1); // true
isTruthy(0); // false
isTruthyExtended:
Everything not falsy is truthy. Made from 'Truthy MDN defenition' Also includes Array and object checking.
const { isTruthyExtended } = require("validatees");
isTruthyExtended(1); // true
isTruthyExtended(0); // false
isTruthyExtended([]); // false
isTruthyExtended({}); // false
isNullish:
Check if value is null or undefined.
const { isNullish } = require("validatees");
isNullish(null); // true
isNullish(undefined); // true
isNullish(0); // false
isString:
Check if value is a string.
const { isString } = require("validatees");
isString("string"); // true
isString(1); // false
isNumber:
Check if value is a number.
const { isNumber } = require("validatees");
isNumber(1); // true
isNumber(Infinity); // true
isNumber("string"); // false
Matchers
Matchers are functions that check if a value matches a certain pattern or value.
isSoftMatch: Check if two values soft match with each other.
const { isSoftMatch } = require("validatees");
isSoftMatch("string", "STRING"); // true
isSoftMatch("string", "abc"); // false
isSoftMatch(1, 1.0); // true