{"id":19248282,"url":"https://github.com/anshu-krishna/js-data-validator-advanced","last_synced_at":"2026-06-22T07:31:27.997Z","repository":{"id":127241979,"uuid":"465229392","full_name":"anshu-krishna/JS-Data-Validator-Advanced","owner":"anshu-krishna","description":"A JS module for data validation of complexly-structured-data.","archived":false,"fork":false,"pushed_at":"2022-04-18T09:38:45.000Z","size":247,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-23T16:14:53.458Z","etag":null,"topics":["data-validation","data-validator","javascript","validation","validator"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anshu-krishna.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2022-03-02T09:00:16.000Z","updated_at":"2022-04-12T05:58:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"a9a61715-fc0b-4967-87c5-48bc60c30dd2","html_url":"https://github.com/anshu-krishna/JS-Data-Validator-Advanced","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/anshu-krishna/JS-Data-Validator-Advanced","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anshu-krishna%2FJS-Data-Validator-Advanced","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anshu-krishna%2FJS-Data-Validator-Advanced/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anshu-krishna%2FJS-Data-Validator-Advanced/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anshu-krishna%2FJS-Data-Validator-Advanced/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anshu-krishna","download_url":"https://codeload.github.com/anshu-krishna/JS-Data-Validator-Advanced/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anshu-krishna%2FJS-Data-Validator-Advanced/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34639704,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["data-validation","data-validator","javascript","validation","validator"],"created_at":"2024-11-09T18:07:12.801Z","updated_at":"2026-06-22T07:31:27.978Z","avatar_url":"https://github.com/anshu-krishna.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Advanced JS Data Validator\r\nA JS module for data validation of complexly-structured-data.\r\n\r\n----\r\n### ***Readme and examples are under construction. Please check later.***\r\n----\r\n## Installation:\r\n\r\n```javascript\r\n\u003cscript type=\"module\"\u003e\r\nimport { DataValidator } from 'https://cdn.jsdelivr.net/gh/anshu-krishna/JS-Data-Validator-Advanced@1.2/src/data-validator-min.js';\r\n\r\n// Your code goes here\r\n\u003c/script\u003e\r\n```\r\n\r\n----\r\n\r\n## Features:\r\n* Supported types:\r\n\t* `any` :  Any value\r\n\t---\r\n\t* `bool` : Boolean value\r\n\t---\r\n\t* `null` : Null value\r\n\t---\r\n\t* `num` : Alias to float\r\n\t* `float` : Real-number value\r\n\t* `int` : Integer value\r\n\t* `unsigned` : Integer value \u003e= 0 \r\n\t* `hex` : String containing a hex value\r\n\t---\r\n\t* `string` : String value\r\n\t* `base64` : String containing base64url encoded value\r\n\t* `email` : String containing an email address\r\n\t* `json` : String containing JSON value\r\n\t* `timestamp` : String containing a timestamp.\\\r\n\t\t\t\t\teg: '2021-01-31', '01-Jan-2021', 'January 1, 2021 05:00:10 AM GMT+05:30', etc.\r\n\t* `url` : String containing a URL\r\n\r\n* Multiple alternative data types can be set for a data item. eg: `'int|float|null'`, `'email|null'`, etc.\r\n\r\n* Data-Type/Structure can be transformed to another Data-Type/Structure(s) ***recursively***.\r\n\r\n----\r\n## Basic Example:\r\n```javascript\r\nimport { DataValidator as DV } from './data-validator.js';\r\n\r\nconst dv = (() =\u003e {\r\n\ttry {\r\n\t\treturn DV.New`\r\n\t\tstring.split('.') =\u003e [ /* Split into three parts; */\r\n\t\t\tbase64 =\u003e json =\u003e { /* Convert from base64; Parse JSON; */\r\n\t\t\t\talg: string.allowed('HS256', 'HS512'), /* Test for supported algo type */\r\n\t\t\t\ttyp: string.allowed('JWT'),\r\n\t\t\t},\r\n\t\t\tbase64 =\u003e json =\u003e { /* Convert from base64; Parse JSON; */\r\n\t\t\t\t?exp: unsigned, /* Optional exp */\r\n\t\t\t\t?iat: unsigned, /* Optional iat */\r\n\t\t\t\t?nbf: unsigned, /* Optional nbf */\r\n\t\t\t\t?name: ([..2..string,].join(' ')|string), /* Name can be:\r\n\t\t\t\t\tan array with first-name and last-name\r\n\t\t\t\t\tOR\r\n\t\t\t\t\ta string containing the full-name\r\n\t\t\t\t*/\r\n\t\t\t\t...\r\n\t\t\t},\r\n\t\t\tbase64 /* Convert from base64; */\r\n\t\t]`;\r\n\t} catch (error) {\r\n\t\tconsole.error(error);\r\n\t\treturn null;\r\n\t}\r\n})();\r\n\r\nif(dv !== null) {\r\n\t{\r\n\t\t/*\r\n\t\tJWT HEAD = { \"alg\": \"HS256\", \"typ\": \"JWT\" }\r\n\t\tJWT PAYLOAD = { \"sub\": \"1234567890\", \"name\": \"John Doe\", \"iat\": 1516239022 }\r\n\t\t*/\r\n\t\tconst {valid, value, error} = dv.validate(`eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c`);\r\n\t\t\r\n\t\tconsole.log('Result:\\n\\tValid:', valid, '\\n\\tValue:', value, '\\n\\tError:', error);\r\n\t}\r\n\t{\r\n\t\t/*\r\n\t\tJWT HEAD = { \"alg\": \"HS256\", \"typ\": \"JWT\" }\r\n\t\tJWT PAYLOAD = { \"sub\": \"1234567890\", \"name\": [\"John\",\"Doe\"], \"iat\": 1516239022, \"nbf\": 1516239021, \"exp\": 1516239122 }\r\n\t\t*/\r\n\t\tconst {valid, value, error} = dv.validate(`eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6WyJKb2huIiwiRG9lIl0sImlhdCI6MTUxNjIzOTAyMiwibmJmIjoxNTE2MjM5MDIxLCJleHAiOjE1MTYyMzkxMjJ9.obXwAnyGDz8UlzMjmo2gUVjyVj8tfkaoJanBSPErzz8`);\r\n\t\t\r\n\t\tconsole.log('Result:\\n\\tValid:', valid, '\\n\\tValue:', value, '\\n\\tError:', error);\r\n\t}\r\n}\r\n```\r\nOutput:\r\n```\r\nResult:\r\n\tValid: true \r\n\tValue: [{\r\n\t\t\t\"alg\": \"HS256\",\r\n\t\t\t\"typ\": \"JWT\"\r\n\t\t}, {\r\n\t\t\t\"sub\": \"1234567890\",\r\n\t\t\t\"name\": \"John Doe\",\r\n\t\t\t\"iat\": 1516239022\r\n\t\t},\r\n\t\t\"IùJÇ\\u0004IHÇ(]Oð¤Ç~:N²%_Úu\\u000b,Ã\"\r\n\t]\r\n\tError: null\r\n\r\nResult:\r\n\tValid: true \r\n\tValue: [{\r\n\t\t\t\"alg\": \"HS256\",\r\n\t\t\t\"typ\": \"JWT\"\r\n\t\t}, {\r\n\t\t\t\"sub\": \"1234567890\",\r\n\t\t\t\"name\": \"John Doe\",\r\n\t\t\t\"iat\": 1516239022,\r\n\t\t\t\"nbf\": 1516239021,\r\n\t\t\t\"exp\": 1516239122\r\n\t\t},\r\n\t\t\"¡µð\\u0002|\\u000f?\\u00143# QXòV?-~F¨%©ÁHñ+Ï?\"\r\n\t]\r\n\tError: null\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanshu-krishna%2Fjs-data-validator-advanced","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanshu-krishna%2Fjs-data-validator-advanced","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanshu-krishna%2Fjs-data-validator-advanced/lists"}