{"id":21294177,"url":"https://github.com/dwtechs/checkard.js","last_synced_at":"2025-07-02T23:33:38.063Z","repository":{"id":259104183,"uuid":"875976267","full_name":"DWTechs/Checkard.js","owner":"DWTechs","description":"Type checking library for Javascript, Typescript and Node.js to test if a given variable is what it is supposed to be","archived":false,"fork":false,"pushed_at":"2025-03-23T15:36:25.000Z","size":714,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-18T18:50:48.037Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DWTechs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-21T07:37:52.000Z","updated_at":"2025-03-23T15:36:29.000Z","dependencies_parsed_at":"2024-11-12T19:32:12.671Z","dependency_job_id":null,"html_url":"https://github.com/DWTechs/Checkard.js","commit_stats":null,"previous_names":["dwtechs/checkard.js"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/DWTechs/Checkard.js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DWTechs%2FCheckard.js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DWTechs%2FCheckard.js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DWTechs%2FCheckard.js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DWTechs%2FCheckard.js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DWTechs","download_url":"https://codeload.github.com/DWTechs/Checkard.js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DWTechs%2FCheckard.js/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263233609,"owners_count":23434888,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-21T13:58:04.946Z","updated_at":"2025-07-02T23:33:38.035Z","avatar_url":"https://github.com/DWTechs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n[![License: MIT](https://img.shields.io/npm/l/@dwtechs/checkard.svg?color=brightgreen)](https://opensource.org/licenses/MIT)\n[![npm version](https://badge.fury.io/js/%40dwtechs%2Fcheckard.svg)](https://www.npmjs.com/package/@dwtechs/checkard)\n[![last version release date](https://img.shields.io/github/release-date/DWTechs/Checkard.js)](https://www.npmjs.com/package/@dwtechs/checkard)\n![Jest:coverage](https://img.shields.io/badge/Jest:coverage-100%25-brightgreen.svg)\n[![minified size](https://img.shields.io/bundlephobia/min/@dwtechs/checkard?color=brightgreen)](https://www.npmjs.com/package/@dwtechs/checkard)\n\n- [Synopsis](#synopsis)\n- [Support](#support)\n- [Installation](#installation)\n- [Usage](#usage)\n  - [ES6](#es6)\n  - [CommonJS](#commonjs)\n  - [IIFE](#iife)\n- [API Reference](#api-reference)\n- [Contributors](#contributors)\n- [Stack](#stack)\n\n\n## Synopsis\n\n**[Checkard.js](https://github.com/DWTechs/Checkard.js)** is an open source dynamic type checking library for Javascript, Typescript and Node.js to test if a given variable is what it is supposed to be (\nFunction, object, ascii, boolean, integer, string, json, email...)\n\n- No dependency\n- Very lightweight\n- Thoroughly tested\n- Works in Javascript, Typescript and Node.js\n- Can be used as CommonJS module, EcmaScrypt module or IIFE \n- Old browsers support\n\n\n## Support\n\n- android: 2.2,\n- chrome: 34,\n- edge: 12,\n- firefox: 11,\n- ie: 9,\n- ios: 4.2,\n- opera: 28,\n- safari: 5.1,\n- samsung: 4,\n- Node.js: 14\n\nThose are the oldest targeted versions. The library should work properly on older devices but we do not support it officially.  \n\n\n## Installation\n\n```bash\n$ npm i @dwtechs/checkard\n```\n\n\n## Usage\n\n\n### ES6 / TypeScript\n\n```typescript\n\nimport { isFunction, isArray, isString } from \"@dwtechs/checkard\";\n\nif (isFunction(variable)) {\n  //variable is a function\n}\n\nif (!isArray(variable, '=', 2)) {\n  //variable is not an array of length 2\n}\n\nif (!isString(variable)) {\n  // variable is not a string\n}\n\nif (isString(variable, \"!0\")) {\n  // variable is a string and is not empty\n}\n\nif (isString(variable, \"\u003e\", 2)) {\n  // variable is a string of length greater than 2\n}\n\n```\n\n\n### CommonJS\n\n```javascript\n\nconst ch = require(\"@dwtechs/checkard\");\n// you may need to use \"require(\"@dwtechs/checkard/dist/ch\"); with Node.js old versions\"\n\nif (ch.isFunction(variable)) {\n  //variable is a function\n}\n\nif (!ch.isArray(variable, '=', 2)) {\n  //variable is not an array of length 2\n}\n\nif (!ch.isString(variable)) {\n  // variable is not a string\n}\n\nif (ch.isString(variable, \"!0\")) {\n  // variable is a string and is not empty\n}\n\nif (ch.isString(variable, \"\u003e\", 2)) {\n  // variable is a string of length greater than 2\n}\n\n```\n\n\n### IIFE\n\n```html\n\u003cscript src=\"node_modules/@dwtechs/checkard/dist/ch.iife.min.js\"\u003e\u003c/script\u003e\n```\n\n```javascript\n\nif (ch.isFunction(variable)) {\n  //variable is a function\n}\n\nif (!ch.isArray(variable, '=', 2)) {\n  //variable is not an array of length 2\n}\n\nif (!ch.isString(variable)) {\n  // variable is not a string\n}\n\nif (ch.isString(variable, \"!0\")) {\n  // variable is a string and is not empty\n}\n\nif (ch.isString(variable, \"\u003e\", 2)) {\n  // variable is a string of length greater than 2\n}\n\n```\n\n\n## API Reference\n\n\n### Types\n\n```javascript\n\ntype Comparator = '='|'\u003c'|'\u003e'|'\u003c='|'\u003e='|'!='|'!0'|'0';\n\ntype PasswordOptions = {\n  lowerCase: boolean,\n  upperCase: boolean,\n  number: boolean,\n  specialCharacter: boolean,\n  maxLength: number,\n  minLength: number\n}\n\n```\n\n\n### Primitive\n---\n\nprimitive methods accept any variable as parameter in order to check its type.\n\n```typescript\n\n/**\n * Checks if the given value is a boolean.\n *\n * @param {unknown} v - The value to check.\n * @returns {boolean} True if the value is a boolean, otherwise false.\n */\nisBoolean(v: unknown): v is boolean {}\n\n/**\n * Checks if the given value is a number and optionally check its length.\n * If type checking  = false, string values like '4', '0', '8e4', '+true', '0x44' return true\n *\n * @param {unknown} v - The value to check.\n * @param {boolean} [type=true] - A boolean indicating whether to perform type checking. Defaults to true.\n * @param {Comparator | null} [comparator=null] - An optional comparator to compare the value. Defaults to null.\n * @param {number | null} [limit=null] - An optional limit to compare the value against. Defaults to null.\n * @returns {boolean} True if the value is a number and passes all checks, otherwise false.\n */\nisNumber(\n    v: unknown, \n    type = true,\n    comparator = null, \n    limit = null\n): v is number {}\n\n/**\n * Checks if the given value is a string and optionally checks its length.\n *\n * @param {unknown} v - The value to check.\n * @param {Comparator | null} [comparator=null] - An optional comparator to compare the string length.\n * @param {number | null} [limit=null] - An optional limit to compare the string length against.\n * @returns {boolean} True if the value is a string and meets the limit conditions, otherwise false.\n */\nisString(\n    v: unknown, \n    comparator = null, \n    limit = null\n): v is string {}\n\n/**\n * Checks if the provided value is a symbol.\n *\n * @param {unknown} v - The value to check.\n * @returns {boolean} True if the value is a symbol, otherwise false.\n */\nisSymbol(v: unknown): v is symbol {}\n\n/**\n * Checks if the given value is null or undefined.\n *\n * @param {unknown} v - The value to check.\n * @returns {boolean} True if the value is null or undefined, otherwise false.\n */\nisNil(v: unknown): v is null | undefined {}\n\n/**\n * Checks if the given value is null.\n *\n * @param {unknown} v - The value to check.\n * @returns {boolean} True if the value is null, otherwise false.\n */\nisNull(v: unknown): v is null {}\n\n/**\n * Checks if the given value is undefined.\n *\n * @param {unknown} v - The value to check.\n * @returns {boolean} True if the value is undefined, otherwise false.\n */\nisUndefined(v: unknown): v is undefined {}\n\n```\n\nUsage example for isString method: \n\n```javascript\n\nimport { isString } from \"@dwtechs/checkard\";\n\nconst str = 'dog';\n\nif (isString(str)) {\n  // check if str is a string\n}\n\nif (isString(str, '!0')) {\n  // check if str is not empty\n}\n\nif (isString(str, '0')) {\n  // check if str is empty\n}\n\nif (isString(str, '=', 2)) {\n  // check if str is a string of length 2\n}\n\nif (isString(str, '\u003e=', 1)) {\n  // check if str is a string of length greater than or equal to 1\n}\n\n```\n\n#### Note \n\nIf **isString()** returns false, Typescript will consider *str* is not a string.  \nSo if you need to check if *str* is of length x but needs to be considered as a string even if its length is not x you should do it like this:\n\n```javascript\n\nimport { isString, isStringOfLength } from \"@dwtechs/checkard\";\n\nconst str = 'dog';\n\nif (isString(str) \u0026\u0026 !isStringOfLength(str, 4, 4)) {\n  // string is of type string even if length is not 4\n}\n\n```\n\n### Non-primitive\n---\n\nNon-primitive methods accept any variable as parameter in order to check its type.\n\n```typescript\n\n/**\n * Checks if the given value is an object and optionally if it is not empty.\n *\n * @template T - The expected type of the object.\n * @param {unknown} v - The value to check.\n * @param {boolean} [empty=false] - If true, the function will also check if the object is not empty.\n * @returns {o is object \u0026 T} True if the value is an object (and not empty if specified), otherwise false.\n */\nisObject\u003cT = unknown\u003e(\n  o: unknown, \n  empty = false\n): o is object \u0026 T {}\n\n/**\n * Checks if the given value is an array and optionally compares its length.\n *\n * @template T - The type of elements in the array.\n * @param {unknown} v - The value to check.\n * @param {Comparator | null} [comparator=null] - An optional comparator function to compare the array length.\n * @param {number | null} [limit=null] - An optional limit to compare the array length against.\n * @returns {boolean} True if the value is an array and meets the limit conditions, otherwise false.\n */\nisArray\u003cT = unknown\u003e(\n    v: unknown, \n    comparator = null, \n    limit = null\n): v is T[] {}\n\n/**\n * Checks if the given input is a valid JSON string.\n *\n * @param {unknown} v - The value to check.\n * @returns {boolean} True if the input is a valid JSON string, otherwise false.\n */\nisJson(v: unknown): v is JSON {} \n\n/**\n * Checks if the given value is a regular expression.\n *\n * @param {unknown} v - The value to check.\n * @param {boolean} [type=true] - A boolean indicating whether to perform type checking. Defaults to true.\n * If false, String values like '/^abc$/' are considered as regular expressions.\n * @returns {boolean} True if v is a RegExp or can be converted to a RegExp, otherwise false.\n */\nisRegex(v: unknown, type = true): v is RegExp {} \n\n/**\n * Checks if the given value is a valid Date object.\n *\n * @param {unknown} v - The value to check.\n * @returns {boolean} True if the value is a Date object, otherwise false.\n *\n */\nisDate(v: unknown): v is Date {}\n\n/**\n * Checks if the provided value is a function.\n *\n * @param {unknown} v - The value to check.\n * @returns {boolean} True if the value is a function, otherwise false.\n */\nisFunction(v: unknown): v is (...args: unknown[]) =\u003e unknown {}\n\n```\n\nUsage example for isArray method: \n\n```typescript\n\nimport { isArray } from \"@dwtechs/checkard\";\n\nlet arr = ['dog','cat','bird'];\n\nif (isArray(arr)) {\n  // check if arr is an array\n}\n\nif (isArray(arr, '!0')) {\n  // arr is not empty\n}\n\nif (isArray(arr, '=', 2)) {\n  // arr is an array of length 2\n}\n\nif (isArray(arr, '\u003e=', 1)) {\n  // arr is an array of length greater than or equal to 1\n}\n\n```\n\n#### Note \n\nNote that if **isArray()** returns false Typescript will consider *arr* is not an array.  \nSo if you need to check *arr* is of length x but needs to be considered as an array even if its length is not x you can do it like this:\n\n```javascript\n\nimport { isArray, isArrayOfLength } from \"@dwtechs/checkard\";\n\nlet arr = ['dog','cat','bird'];\n\nif (isArray(arr) \u0026\u0026 !isArrayOfLength(arr, 4, 4)) {\n  // array is of type array even if length is not 4\n}\n\n```\n\n### Boolean\n---\n\n```typescript\n\n/**\n * Checks if a value is falsy.\n *\n * A value is considered falsy if it is : \n * false,\n * 0, \n * -0,\n * \"\",\n * null,\n * undefined,\n * NaN,\n * 0n.\n *\n * @param {unknown} v - The value to check.\n * @returns {boolean} True if the value is falsy, otherwise false.\n */\nfunction isFalsy(v: unknown): boolean {}\n\n/**\n * Checks if a value is truthy.\n *\n * A value is considered truthy if it is : \n * true: The boolean value true.\n * Non-zero numbers: Any number other than 0 or -0.\n * Non-empty strings: Any string with at least one character.\n * Objects: Any object, including empty objects and arrays.\n * Symbols: Any symbol.\n * BigInt values: Any BigInt value other than 0n.\n *\n * @param {unknown} v - The value to check.\n * @returns {boolean} True if the value is truthy, otherwise false.\n */\nfunction isTruthy(v: unknown): boolean {}\n\n```\n\n### Number\n---\n\n```typescript\n\n/**\n * Checks if a given number is an integer.\n *\n * @param {number | string | undefined | null} n - The number to check.\n * @param {boolean} [type=true] - Optional boolean indicating whether to perform type checking. Defaults to true.\n * @returns {boolean} True if the number is an integer, otherwise false.\n */\nisInteger(n: number | string | undefined | null, type = true): boolean {}\n\n/**\n * Checks if a given number is a floating-point number.\n *\n * @param {number | string | undefined | null} n - The number to check.\n * @param {boolean} [type=true] - Optional boolean indicating whether to perform type checking. Defaults to true.\n * @returns {boolean} True if the number is a floating-point number, otherwise false.\n */\nisFloat(n: number | string | undefined | null, type = true): boolean {}\n\n/**\n * Checks if a given number is even.\n *\n * @param {number | string | undefined | null} n - The number to check.\n * @param {boolean} [type=true] - Optional boolean indicating whether to perform type checking. Defaults to true.\n * @returns {boolean} True if the number is an even integer, otherwise false.\n */\nisEven(n: number | string | undefined | null, type = true): boolean {}\n\n/**\n * Determines if a given number is odd.\n *\n * @param {number | string | undefined | null} n - The number to check.\n * @param {boolean} [type=true] - Optional boolean indicating whether to perform type checking. Defaults to true.\n * @returns {boolean} True if the number is an odd integer, otherwise false.\n */\nisOdd(n: number | string | undefined | null, type = true): boolean {}\n\n/**\n * Checks if a given number is zero.\n *\n * @param {number | string | undefined | null} n - The number to check.\n * @param {boolean} [type=true] - Optional boolean indicating whether to perform type checking. Defaults to true.\n * @returns {boolean} True if the number is zero, otherwise false.\n */\nisOrigin(n: number | string | undefined | null, type = true): boolean {}\n\n/**\n * Checks if a given number is positive.\n *\n * @param {number | string | undefined | null} n - The number to check.\n * @param {boolean} [type=true] - Optional boolean indicating whether to perform type checking. Defaults to true.\n * @returns {boolean} True if the number is positive, otherwise false.\n * \n * @remarks\n * This function also check if the value is a number.\n */\nisPositive(n: number | string | undefined | null, type = true): boolean {}\n\n/**\n * Checks if a given number is negative.\n *\n * @param {number | string | undefined | null} n - The number to check.\n * @param {boolean} [type=true] - Optional boolean indicating whether to perform type checking. Defaults to true.\n * @returns {boolean} True if the number is negative, otherwise false.\n *  \n * @remarks\n * This function also check if the value is a number.\n */\nisNegative(n: number | string | undefined | null, type = true): boolean {}\n\n/**\n * Checks if a given number is a power of two.\n *\n * @param {number | string | undefined | null} n - The number to check.\n * @param {boolean} [type=true] - Optional boolean indicating whether to perform type checking. Defaults to true.\n * @returns {boolean} True if the number is a power of two, otherwise false.\n */\nisPowerOfTwo(n: number | string | undefined | null, type = true): boolean {}\n\n/**\n * Checks if a given number is an ASCII code.\n *\n * @param {number | undefined | null} n - The number to check.\n * @param {boolean} [ext=true] - Optional boolean to include extended ASCII range (0-255). Defaults to true.\n * @returns {boolean} True if the number is a valid ASCII code, otherwise false.\n */\nisAscii(n: number | undefined | null, ext = true): boolean {}\n\n```\n\n\n### Valid number\n---\n\nValid number methods take a number as parameter and check of the number lies in the right interval\n\n```typescript\n\n/**\n * Checks if a given value is a valid number within given range.\n *\n * @param {number | string | undefined | null} n - The number to check\n * @param {number} [min=-999999999] - minimal value of the range\n * @param {number} [max=999999999] - maximal value of the range\n * @param {boolean} [type=true] - whether to perform type checking\n * @returns {boolean} True if the value is a valid number, otherwise false.\n *  \n * @remarks\n * This function also check if the value is a number.\n */\nisValidNumber(\n    n: number | string | undefined | null, \n    min = -999999999, \n    max = 999999999, \n    type = true \n): boolean {}\n\n/**\n * Checks if a given value is a valid integer within given range.\n *\n * @param {number | string | undefined | null} n - The number to check\n * @param {number} [min=-999999999] - minimal value of the range\n * @param {number} [max=999999999] - maximal value of the range\n * @param {boolean} [type=true] - whether to perform type checking\n * @returns {boolean} True if the value is a valid integer, otherwise false.\n */\nisValidInteger(\n    n: number | string | undefined | null, \n    min = -999999999, \n    max = 999999999, \n    type = true\n): boolean {}\n\n/**\n * Checks if a given value is a valid float within given range.\n *\n * @param {number | string | undefined | null} n - The number to check\n * @param {number} [min=-999999999.9] - minimal value of the range\n * @param {number} [max=999999999.9] - maximal value of the range\n * @param {boolean} [type=true] - whether to perform type checking\n * @returns {boolean} True if the value is a valid float, otherwise false.\n */\nisValidFloat( \n    n: number | string | undefined | null, \n    min = -999999999.9, \n    max = 999999999.9, \n    type = true \n): boolean {}\n\n```\n\n\n### String\n---\n\n```typescript\n\n/**\n * Checks if the length of a given string is within the specified range.\n *\n * @param {string | undefined | null} s - The string to check.\n * @param {number} [min=0] - The minimum length of the string (inclusive). Default is 0.\n * @param {number} [max=999999999] - The maximum length of the string (inclusive). Default is 999999999.\n * @returns {boolean} True if the string length is within the specified range, otherwise false.\n */\nisStringOfLength( \n    s: string | undefined | null, \n    min = 0, \n    max = 999999999 \n): boolean {}\n\n/**\n * Checks if the given string is a valid email address.\n *\n * @param {string | undefined | null} s - The string to be checked.\n * @returns {boolean} True if the string is a valid email address, otherwise false.\n */\nisEmail(s: string | undefined | null): boolean {}\n\n/**\n * Checks if the given string is a valid IP address.\n *\n * @param {string | undefined | null} s - The string to be checked.\n * @returns {boolean} True if the string is a valid IP address, otherwise false.\n */\nisIpAddress(s: string | undefined | null): boolean {}\n\n/**\n * Checks if a given string is a valid Base64 encoded string.\n *\n * @param {string | undefined | null} s - The string to check.\n * @param {boolean} [urlEncoded=false] - Optional. If true, checks for URL-safe Base64 encoded strings. Defaults to false.\n * @returns {boolean} True if the string is a valid Base64 encoded string, otherwise false.\n */\nisBase64(s: string | undefined | null, urlEncoded = false): boolean {}\n\n/**\n * Checks if a given string is a valid JSON Web Token (JWT).\n *\n * A valid JWT consists of three parts separated by dots ('.'):\n * - Header\n * - Payload\n * - Signature\n *\n * Each part must be a valid Base64 encoded string. Additionally, the header and payload\n * must be valid JSON objects when decoded.\n *\n * @param {string | undefined | null} s - The string to check.\n * @returns {boolean} True if the string is a valid JWT, otherwise false.\n */\nisJWT(s: string | undefined | null): boolean {}\n\n/**\n * Checks if the given string is a valid slug.\n * \n * A slug is typically a URL-friendly string that contains only lowercase letters, numbers, and hyphens.\n * \n * @param {string | undefined | null} s - The string to check.\n * @returns {boolean} True if the string is a valid slug, otherwise false.\n */\nisSlug(s: string | undefined | null): boolean {}\n\n/**\n * Checks if the given string is a valid hexadecimal number.\n *\n * @param {string | undefined | null} s - The string to check.\n * @returns {boolean} True if the string is a valid hexadecimal number, otherwise false.\n */\nisHexadecimal(s: string | undefined | null): boolean {}\n\n\nconst PwdDefaultOptions = {\n  lowerCase: true,\n  upperCase: true,\n  number: true,\n  specialCharacter: true,\n  minLength: 12,\n  maxLength: 64,\n};\n\n/**\n * Checks if a given password string meets the specified validation criteria.\n *\n * @param {string} s - The password string to validate.\n * @param {PasswordOptions} [options=PwdDefaultOptions] - Optional configuration object to specify password validation criteria.\n * @returns {boolean} True if the password meets all the specified criteria, otherwise false.\n *\n * @example\n * const options = {\n *   minLength: 8,\n *   maxLength: 20,\n *   lowerCase: true,\n *   upperCase: true,\n *   number: true,\n *   specialCharacter: true\n * };\n * const isValid = isValidPassword('Password123!', options);\n */\nisValidPassword(\n    s: string, \n    options = PwdDefaultOptions\n): boolean {}\n\n/**\n * Checks if the given string contains any uppercase letters.\n *\n * @param {string} s - The string to check.\n * @returns {boolean} True if the string contains at least one uppercase letter, otherwise false.\n */\ncontainsUpperCase(s: string): boolean {}\n\n/**\n * Checks if the given string contains at least one lowercase letter.\n *\n * @param {string} s - The string to check.\n * @returns {boolean} True if the string contains at least one lowercase letter, otherwise false.\n */\ncontainsLowerCase(s: string): boolean {}\n\n/**\n * Checks if the given string contains any special characters.\n *\n * @param {string} s - The string to be checked.\n * @returns {boolean} True if the string contains special characters, otherwise false.\n */\ncontainsSpecialCharacter(s: string): boolean {}\n\n/**\n * Checks if a given string contains a specified number of digits.\n *\n * @param {string} s - The string to check.\n * @param {number} [min=1] - The minimum number of digits required in the string. Defaults to 1.\n * @param {number|null} [max=null] - The maximum number of digits allowed in the string. If not provided, there is no upper limit.\n * @returns {boolean} True if the string contains the required number of digits, otherwise false.\n */\ncontainsNumber(\n    s: string, \n    min = 1, \n    max = null\n): boolean {}\n\n```\n\n#### Note \n\nString methods take a string as parameter.  \nUse **isString()** method before any string method if you are not sure about the variable type you will receive.\n\nExample : \n\n```javascript\n\nimport { isString, isEmail } from \"@dwtechs/checkard\";\n\nif (isString(value) \u0026\u0026 isEmail(value)) {\n  // value is an email\n}\n\n```\n\nUsage example for isValidPassword: \n\n```javascript\n\nimport { isValidPassword } from \"@dwtechs/checkard\";\n\nconst PwdOptions = {\n  lowerCase: true,\n  upperCase: true,\n  number: true,\n  specialCharacter: false,\n  minLength: 12,\n  maxLength: 16,\n};\nconst password = 'teSt1234';\n\nif (isValidPassword(password, PwdOptions)) {\n  // check if password is valid compared to PwdOptions\n}\n\n```\n\n\n### Date\n---\n\n```typescript\n\nconst minDate = new Date('1/1/1900');\nconst maxDate = new Date('1/1/2200');\n\n/**\n * Checks if a given date is valid within a specified range.\n *\n * @param {Date} d - The date to be validated.\n * @param {Date} [min=minDate] - The minimum allowable date. Defaults to `minDate`.\n * @param {Date} [max=maxDate] - The maximum allowable date. Defaults to `maxDate`.\n * @returns {boolean} True if the date is valid and within the specified range, otherwise false.\n *  \n * @remarks\n * This function also check if the value is an instance of the Date object.\n */\nisValidDate(\n    d: date, \n    min = minDate, \n    max = maxDate\n): boolean {}\n\n/**\n * Checks if the given number is a valid timestamp.\n *\n * @param {number} t - The number to check.\n * @param {boolean} [type=true] - An optional boolean parameter to verify the type of t. Defaults to true.\n * @returns {boolean} True if the value is a timestamp, otherwise false.\n */\nisTimestamp(t: number, type = true): boolean {}\n\n/**\n * Checks if a given timestamp is valid within a specified range.\n *\n * @param {number} t - The timestamp to validate.\n * @param {number} [min=-2208989361000] - The minimum allowed timestamp. Default is -2208989361000,eg 1/1/1900.\n * @param {number} [max=7258114800000] - The maximum allowed timestamp. Default is 7258114800000, eg 1/1/2200).\n * @param {boolean} [type=true] - A boolean indicating the type of timestamp. Default to true.\n * @returns {boolean} True if the timestamp is valid and within the specified range, otherwise false.\n * \n * @remarks\n * This function also check if the value is timestamp.\n */\nisValidTimestamp(\n  t: number, \n  min = -2208989361000, \n  max = 7258114800000, \n  type = true\n): boolean {} \n\n```\n\n\n### Array\n---\n\n```typescript\n\n/**\n * Checks if the length of an array is within the specified range.\n *\n * @param {unknown[]} a - The array to check.\n * @param {number} [min=0] - The minimum length of the array (inclusive).\n * @param {number} [max=999999999] - The maximum length of the array (inclusive).\n * @returns {boolean} True if the array length is within the specified range, otherwise false.\n */\nisArrayOfLength(\n    a: unknown[], \n    min = 0, \n    max = 999999999\n): boolean {}\n\n/**\n * Checks if a value is present in an array starting from a specified index.\n *\n * @param {unknown[]} a - The array to search within.\n * @param {unknown} v - The value to search for.\n * @param {number} [from=0] - The index to start the search from. Defaults to 0.\n * @returns {boolean} True if the value is found in the array, otherwise false.\n */\nisIn(\n    a: unknown[], \n    v: unknown, \n    from = 0\n): boolean {}\n\n```\n\nUsage example : \n\n```javascript\n\nimport { isIn } from \"@dwtechs/checkard\";\n\n// an array of restricted values\nconst levels = [ \"error\", \"warn\", \"info\", \"debug\" ];\n\n// Basic usage : \nconsole.log(isIn(\"debug\", levels)); // true\nconsole.log(isIn(\"debag\", levels)); // false\n\n// Typical usage : \nconst defaultLvl = \"warn\";\nfunction setLevel(level: Levels): Levels {\n  return isIn(level, levels) ? level : defaultLvl;\n}\nlet lvl = setLevel(\"error\"); // lvl = \"error\"\nlet lvl = setLevel(\"infos\"); // lvl = \"warn\"\n\n```\n\n\n### Object\n---\n\n```typescript\n\n/**\n * Checks if a given property exists on an object.\n * enumerable: boolean - whether to check enumerable properties only\n *\n * @template K - The type of the property key.\n * @param {object} obj - The object to check the property on.\n * @param {K} k - The property key to check for.\n * @param {boolean} [own=true] - If true, checks if the property is an own property of the object. Defaults to true.\n * @param {boolean} [enumerable=true] - If true, checks if the property is enumerable. Defaults to true.\n * @returns {boolean} True if the property exists on the object based on the specified conditions, otherwise false.\n */\nisProperty\u003cK extends PropertyKey\u003e(\n    obj: object,\n    k: K,\n    own = true,\n    enumerable = true\n): boolean // obj is Record\u003cK, { [key: PropertyKey]: unknown }\u003e\n\n```\n\nUsage example : \n\n```javascript\n\nimport { isProperty } from \"@dwtechs/checkard\";\n\n// an object to describe the custom type.\nconst levels = {\n  error: 0,\n  warn: 1,\n  info: 2,\n  debug: 3,\n};\n\n// Basic usage : \nconsole.log(isProperty(\"debug\", levels)); // true\nconsole.log(isProperty(\"debag\", levels)); // false\n\n```\n\n\n### Html\n---\n\n```typescript\n\n/**\n * Checks if the given value is an HTML element.\n *\n * @param {unknown} h - The value to check.\n * @returns {boolean} True if the value is an HTML element, otherwise false.\n */\nisHtmlElement(h: unknown): h is HTMLElement {}\n\n/**\n * Checks if a given string is a valid HTML event attribute.\n *\n * @param {sgtring} h - The string to check.\n * @returns {boolean} True if the string is a valid HTML event attribute, otherwise false.\n *\n * @remarks\n * This function checks against a predefined list of HTML event attributes such as `onclick`, `onload`, `onerror`, etc.\n *\n * @example\n * ```typescript\n * isHtmlEventAttribute(\"onclick\"); // returns true\n * isHtmlEventAttribute(\"onunknown\"); // returns false\n * ```\n */\nisHtmlEventAttribute(h: string): boolean {}\n\n/**\n * Checks if the given value is a DOM Node.\n *\n * @param {unknown} n - The value to check.\n * @returns {boolean} True if the value is a Node, otherwise false.\n */\nisNode(n: unknown): n is Node {}\n\n```\n\n\n### Normalize\n---\n\n```typescript\n\n/**\n * A function to capitalize the first letter of each word in a string.\n *\n * @param {string} s - The input string to capitalize.\n * @param {boolean} everyWords - A flag to indicate whether to capitalize the first letter of every word or just the first letter of the whole string.\n * @return {string} The string with the first letter of each word capitalized.\n */\nucfirst(s: string, everyWords = true): string {}\n\n/**\n * Returns a normalized nickname for a user.\n *\n * If the nickname is not given, the function will create a nickname\n * based on the first letter of the first name and the last name.\n *\n * nickname accepts a-z - and _ characters\n * \n * @param {string} nickname - The nickname of the user.\n * @param {string} firstName - The first name of the user.\n * @param {string} lastName - The last name of the user.\n * @return {string | false} The normalized nickname.\n */\nnormalizeNickname(\n    nickname: string, \n    firstName: string, \n    lastName: string\n): string | false {}\n\n/**\n * Normalizes a name by capitalizing the first letter of each word.\n *\n * @param {string} s - The name to normalize.\n * @return {string | false} The normalized name.\n */\nnormalizeName(s: string): string | false {}\n\n/**\n * A function to normalize an email address.\n *\n * If the string is not a valid email address, the function will return false.\n *\n * @param {string} s - The email address to normalize.\n * @return {string | false} The normalized email address or false if the\n * string is not a valid email address.\n */\nnormalizeEmail(s: string): string | false {}\n\n```\n\nExample : \n\n```javascript\n\nconst ch = require(\"@dwtechs/checkard\");\n\nfunction normalizeInputs(req, res, next) {\n  const users = req.body.rows;\n  log.debug(`Normalize values for ${users.length} users`);\n\n  for (const u of users) {\n    const { firstName, lastName, nickname, email } = u;\n    u.firstname = ch.normalizeName(firstName);\n    u.lastname = ch.normalizeName(lastName);\n    u.nickname = ch.normalizeNickname(nickname, firstName, lastName);\n    u.email = ch.normalizeName(email);\n  }\n  next();\n}\n\n```\n\n\n### Base64\n---\n\n```typescript\n\n/**\n * Decodes a base64 encoded string.\n *\n * @param {string} str - The base64 encoded string to decode.\n * @param {boolean} urlSafe - A boolean indicating if the input string is URL safe. Defaults to true.\n * @returns {string} The decoded string in UTF-8 format.\n */\nfunction b64Decode(str: string, urlSafe = true): string;\n\n/**\n * Encodes a given string into Base64 format.\n * \n * @param {string} str - The string to be encoded.\n * @param {boolean} urlSafe - Optional boolean to determine if the output should be URL safe. Defaults to true.\n * @returns {string} The Base64 encoded string. If `urlSafe` is true, the output will be modified to be URL safe.\n */\nfunction b64Encode(str: string, urlSafe = true): string;\n\n```\n\n\n## Contributors\n\nCheckard.js is under continuous development and we would be glad to get all the help you can provide.\nTo contribute please read **[contributor.md](https://github.com/DWTechs/Checkard.js/blob/main/contributor.md)** for detailed installation guide.\n\n\n## Stack\n\n| Purpose         |                    Choice                    |                                                     Motivation |\n| :-------------- | :------------------------------------------: | -------------------------------------------------------------: |\n| repository      |        [Github](https://github.com/)         |     hosting for software development version control using Git |\n| package manager |     [npm](https://www.npmjs.com/get-npm)     |                                default node.js package manager |\n| language        | [TypeScript](https://www.typescriptlang.org) | static type checking along with the latest ECMAScript features |\n| module bundler  |      [Rollup](https://rollupjs.org)       |                        advanced module bundler for ES6 modules |\n| unit testing    |          [Jest](https://jestjs.io/)          |                  delightful testing with a focus on simplicity |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdwtechs%2Fcheckard.js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdwtechs%2Fcheckard.js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdwtechs%2Fcheckard.js/lists"}