{"id":23634989,"url":"https://github.com/wizard04wsu/javascript-type-testing","last_synced_at":"2025-10-08T12:43:10.444Z","repository":{"id":47490798,"uuid":"400581018","full_name":"wizard04wsu/javascript-type-testing","owner":"wizard04wsu","description":"Improved JavaScript type testing","archived":false,"fork":false,"pushed_at":"2025-06-02T00:54:33.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-02T09:07:22.293Z","etag":null,"topics":["javascript","module","type-testing"],"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/wizard04wsu.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-08-27T17:02:57.000Z","updated_at":"2025-04-15T17:31:01.000Z","dependencies_parsed_at":"2024-02-17T17:24:27.344Z","dependency_job_id":"456fe224-8010-46c1-8906-7e22d8a5f607","html_url":"https://github.com/wizard04wsu/javascript-type-testing","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/wizard04wsu/javascript-type-testing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizard04wsu%2Fjavascript-type-testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizard04wsu%2Fjavascript-type-testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizard04wsu%2Fjavascript-type-testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizard04wsu%2Fjavascript-type-testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wizard04wsu","download_url":"https://codeload.github.com/wizard04wsu/javascript-type-testing/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wizard04wsu%2Fjavascript-type-testing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278947971,"owners_count":26073736,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"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":["javascript","module","type-testing"],"created_at":"2024-12-28T05:29:29.147Z","updated_at":"2025-10-08T12:43:10.439Z","avatar_url":"https://github.com/wizard04wsu.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Improved JavaScript Type Testing\n\nA robust alternative to type testing in vanilla JavaScript. Uses an expanded set of type names to simplify common tests.\n\nSee the [test page](https://wizard04wsu.github.io/javascript-type-testing/test/test.htm) for examples.\n\n***Version 4 is not backwards compatible.***\n\n\n## Syntax\n\n\u003e **is**(_value_)\n\nThe return value is an object that describes the argument.\n\n| Member                 | Description\n| - | -\n| .type                  | The type name of _value_.\n| .of(_class_)           | Tests if _value_ is an instance of _class_.\n| .all(_...descriptors_) | Takes descriptor names as arguments. Returns `true` if **all** of them apply to _value_.\n| .any(_...descriptors_) | Takes descriptor names as arguments. Returns `true` if **any** of them apply to _value_.\n| \\[_descriptor_\\]       | Each [descriptor](#types-and-descriptors) property is a boolean that is `true` if it applies to _value_.\n\nEnumerable properties of `is` are string constants of all the descriptor names. These can be used \nin the `.all()` and `.any()` methods instead of string literals.\nFor example, these are equivalent:\n\n\u003e \u003ccode\u003eis(\u003ci\u003evalue\u003c/i\u003e).all(\"number\", \"object\")\u003c/code\u003e\n\n\u003e \u003ccode\u003eis(\u003ci\u003evalue\u003c/i\u003e).all(is.number, is.object)\u003c/code\u003e\n\n\n## Types and Descriptors\n\nTypes in this module do not distinguish between primitives and objects. For example, `5` and `new Number(5)` are both of type \"number\".\n\nA descriptor is a boolean value that is `true` if it applies to the value being tested. Type names are included as descriptors. For example, `5` is associated with the _primitive_, _number_, and _finite_ descriptors, among others.\n\n| Descriptor       | Type Name | Primitive Values              | Instances Of Classes\n| - | - | - | -\n| defined          |           | not undefined                 | `Object`\n| **undefined**    |    yes    | undefined                     | \n| primitive        |           | any primitive value           | \n| **object**       |  yes[^1]  |                               | `Object`\n| objectish        |           | `null`                        | `Object`\n| **null**         |    yes    | `null`                        | \n| nullish          |           | undefined, `null`             | \n| **boolean**      |    yes    | `false`, `true`               | \n| false            |           | `false`                       | \n| true             |           | `true`                        | \n| falsy            |           | undefined, `null`, `false`, `0n`, `NaN`, `0`, `\"\"` | \n| truthy           |           | not a _falsy_ value           | `Object`\n| **symbol**       |    yes    | a `Symbol`                    | \n| **bigint**       |    yes    | `0n`, `5n`                    | \n| numberish        |           | `0`, `5`, `Infinity`, `NaN`   | `Number`\n| **nan**          |    yes    | `NaN`                         | `Number` with value `NaN`\n| **number**       |    yes    | `0`, `5`, `Infinity`          | `Number` excluding those with value `NaN`\n| real[^2]         |           | `0`, `5`                      | `Number` with a finite number value\n| \u003ca name=\"finite\"\u003e\u003c/a\u003efinite           |           | `0`, `5`                      | `Number` with a finite number value\n| infinite         |           | `Infinity`                    | `Number` with an infinite value\n| **string**       |    yes    | `\"\"`, `\"foo\"`                 | `String`\n| **array**        |    yes    | `[]`, `[1,2]`                 | `Array`\n| **map**          |    yes    |                               | `Map`\n| **set**          |    yes    |                               | `Set`\n| **weakmap**      |    yes    |                               | `WeakMap`\n| **weakset**      |    yes    |                               | `WeakSet`\n| empty            |           | `\"\"`, `[]`                    | `String` or `Array` with `.length === 0`,\u003cbr\u003e`Map` or `Set` with `.size === 0`\n| nonempty         |           | `\"foo\"`, `[1,2]`              | `String` or `Array` with `.length \u003e 0`,\u003cbr\u003e`Map` or `Set` with `.size \u003e 0`\n| **date**         |    yes    |                               | `Date`\n| **error**        |    yes    |                               | `Error`\n| **function**     |    yes    |                               | `Function`\n| **promise**      |    yes    |                               | `Promise`\n| **regex**        |    yes    |                               | `Regex`\n\n\n[^1]: The \"object\" type is only used for a value if no other type is appropriate.\n[^2]: Deprecated. Use [_finite_](#finite) instead.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwizard04wsu%2Fjavascript-type-testing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwizard04wsu%2Fjavascript-type-testing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwizard04wsu%2Fjavascript-type-testing/lists"}