{"id":20671156,"url":"https://github.com/allnulled/check-that","last_synced_at":"2025-07-08T13:06:48.896Z","repository":{"id":57096745,"uuid":"441781784","full_name":"allnulled/check-that","owner":"allnulled","description":"Simple JavaScript library to make checkings in a semantic-friendly syntax.","archived":false,"fork":false,"pushed_at":"2023-11-24T08:05:39.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T06:39:00.123Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/allnulled.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-12-26T00:28:46.000Z","updated_at":"2023-03-03T23:36:41.000Z","dependencies_parsed_at":"2023-11-24T08:57:09.557Z","dependency_job_id":null,"html_url":"https://github.com/allnulled/check-that","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"de68dbdc82abffe9e2b7dd2736c34036b2c35d06"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/allnulled/check-that","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fcheck-that","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fcheck-that/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fcheck-that/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fcheck-that/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allnulled","download_url":"https://codeload.github.com/allnulled/check-that/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allnulled%2Fcheck-that/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264275898,"owners_count":23583327,"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-16T20:25:31.861Z","updated_at":"2025-07-08T13:06:48.859Z","avatar_url":"https://github.com/allnulled.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @allnulled/check-that\n\nSimple JavaScript library to make checkings in a semantic-friendly syntax.\n\n## Examples\n\n```js\nimport Check from \"@allnulled/check-that\";\n\nCheck.that(\"\").isString().and.hasLengthLowerThan(1);\nCheck.that(true).isBoolean();\nCheck.that(5).isNumber();\nCheck.that(5).equals(5);\nCheck.that(5).differs(6);\nCheck.that(undefined).isUndefined();\nCheck.that(5).isNotUndefined();\nCheck.that(true).isBoolean();\nCheck.that(true).isTrue();\nCheck.that(false).isFalse();\nCheck.that(\"\").isString();\nCheck.that({}).isObject();\nCheck.that(Check).isFunction();\nCheck.that([]).isArray();\nCheck.that(5).isGreaterThan(4);\nCheck.that(5).isLowerThan(6);\nCheck.that(new Date()).isInstanceOf(Date);\nCheck.that(new Date()).isDate();\nCheck.that([5]).hasLengthGreaterThan(0);\nCheck.that([5]).hasLengthLowerThan(2);\nCheck.that(5).can(v =\u003e v === 5); // The function must return true, otherwise an error will arise\nCheck.that(5).cannot(v =\u003e v !== 5); // The function must return false, otherwise an error will arise\nCheck.that(5).throwsOn(v =\u003e {throw new Error()});\nCheck.that(5).doesNotThrowOn(v =\u003e undefined);\n```\n\n## How it works\n\n- `Check` is the main class.\n- `Check.that(value)` is the same as `new Check(value)`, is a static constructor.\n- The main class' constructor has the following signature:\n  - `Check.that(target:any, targetID:String = \"?\", errorID:String = \"xxxxx\")`\n- The main class has these methods with these signatures:\n  - `isBoolean()`\n  - `isTrue()`\n  - `isFalse()`\n  - `isString()`\n  - `isNumber()`\n  - `equals(value:any, valueID:String = undefined)`\n  - `differs(value:any, valueID:String = undefined)`\n  - `isUndefined()`\n  - `isNotUndefined()`\n  - `isString()`\n  - `isObject()`\n  - `isFunction()`\n  - `isArray()`\n  - `isDate()`\n  - `isIntanceOf(clazz:Function, clazzID:String = undefined)`\n  - `isGreaterThan(value:any, valueID:String = undefined)`\n  - `isLowerThan(value:any, valueID:String = undefined)`\n  - `hasLengthGreaterThan(value:any, valueID:String = undefined)`\n  - `hasLengthLowerThan(value:any, valueID:String = undefined)`\n  - `can(filter:Function, filterID:String = undefined)`\n  - `cannot(filter:Function, filterID:String = undefined)`\n  - `throwsOn(filter:Function, filterID:String = undefined)`\n  - `doesNotThrowOn(filter:Function, filterID:String = undefined)`\n- When one of these methods fails, an error is thrown.\n- When one of these methods succeeds, the `Check` instance itself is returned, in order to chain other checks against the same `target`.\n- The thrown errors have the format:\n  - `\"Expected \u003c{ targetID }\u003e to { type of check expression provided by the method } { valueID when used } [ERROR:{ errorID }]\"`\n- Sometimes, intermediate operations fail. You can find some expression like `-comparable as-` on the error message when this happens.\n- Finally, you can chain checks using `.and`, or not using it too.\n\n## License\n\nDo what you want with it, no license.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallnulled%2Fcheck-that","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallnulled%2Fcheck-that","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallnulled%2Fcheck-that/lists"}