This project has been transferred to DWTechs and is now called CheckHard.js.
Please update your project dependencies to CheckHard.js as Ch.js will not be updated anymore.
Ch.js is an open source type checking library for Javascript.
The goal of this library is to provide an easy way to check if a variable is what it is supposed to be. Function, object, ascii, boolean, integer, string, json, email...
$ npm i @lcluber/chjs
$ yarn add @lcluber/chjs
import { isFunction, isArray } from "@lcluber/chjs";
if (isFunction(variable)) {
//variable is a function
}
if (!isArray(variable)) {
//variable is not an array
}
const ch = require("@lcluber/chjs/dist/ch.cjs");
if (ch.isFunction(variable)) {
//variable is a function
}
if (!ch.isArray(variable)) {
//variable is not an array
}
<script src="node-modules/@lcluber/chjs/dist/ch.iife.min.js"></script>
if (Ch.isFunction(variable)) {
//variable is a function
}
if (!Ch.isArray(variable)) {
//variable is not an array
}
isBoolean(bool: any): boolean {}
isJson(string: any): boolean {}
isFunction(func: any): boolean {}
isObject(object: any): boolean {}
isArray(array: any): boolean {}
isAscii(code: any, extended: boolean = false): boolean {}
isInteger(number: any, typeCheck: boolean = true): boolean {}
isFloat(number: any, typeCheck: boolean = true): boolean {}
// Find out if a variable is a numeric value, including exponential notation, hexadecimal value, etc
isNumber(number: any, typeCheck: boolean = true): boolean {}
isString(string: any): boolean {}
isHtmlElement(htmlElement: any): boolean {}
isHtmlEventAttribute(htmlEventAttribute: any): boolean {}
isNode(node: any): boolean {}
isEven(number: any, typeCheck: boolean = true): boolean {}
isOdd(number: any, typeCheck: boolean = true): boolean {}
isOrigin(number: any, typeCheck: boolean = true): boolean {}
isPositive(number: any, typeCheck: boolean = true): boolean {}
isNegative(number: any, typeCheck: boolean = true): boolean {}
isPowerOfTwo(number: any, typeCheck: boolean = true): boolean {}
isRegex(regex: any, typeCheck: boolean = true): boolean {}
isEmail(email: any): boolean {}
isIpAddress(ipAddress: any): boolean {}
Ch.js is still in development and I would be glad to get all the help you can provide for this project. To contribute please read NOTICE.md for detailed installation guide.
Purpose | Choice | Motivation |
---|---|---|
repository | Github | hosting for software development version control using Git |
package manager | npm | default node.js package manager |
type checking | TypeScript | static type checking along with the latest ECMAScript features |
module bundler | Rollup.js | advanced module bundler for ES6 modules |
unit testing | Jest | delightful testing with a focus on simplicity |