{"id":13526651,"url":"https://github.com/node-modules/is-type-of","last_synced_at":"2025-06-14T03:08:21.765Z","repository":{"id":14914070,"uuid":"17638157","full_name":"node-modules/is-type-of","owner":"node-modules","description":"complete type checking for node","archived":false,"fork":false,"pushed_at":"2023-12-08T12:33:41.000Z","size":63,"stargazers_count":122,"open_issues_count":0,"forks_count":13,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-04-14T12:21:34.348Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/node-modules.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}},"created_at":"2014-03-11T16:43:47.000Z","updated_at":"2024-02-01T03:51:42.000Z","dependencies_parsed_at":"2023-11-25T08:21:16.875Z","dependency_job_id":"6220d1df-e19d-4e2c-b0fc-d4aea7776678","html_url":"https://github.com/node-modules/is-type-of","commit_stats":{"total_commits":45,"total_committers":7,"mean_commits":6.428571428571429,"dds":0.4222222222222223,"last_synced_commit":"756aabaab6758a006eef6abade46eb38ff14e9ae"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fis-type-of","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fis-type-of/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fis-type-of/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fis-type-of/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/node-modules","download_url":"https://codeload.github.com/node-modules/is-type-of/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222530508,"owners_count":16998475,"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-08-01T06:01:32.662Z","updated_at":"2025-06-14T03:08:21.759Z","avatar_url":"https://github.com/node-modules.png","language":"TypeScript","readme":"# is-type-of\n\n[![NPM version][npm-image]][npm-url]\n[![CI](https://github.com/node-modules/is-type-of/actions/workflows/ci.yml/badge.svg)](https://github.com/node-modules/is-type-of/actions/workflows/ci.yml)\n[![Test coverage][codecov-image]][codecov-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n[![Node.js Version][node-version-image]][node-version-url]\n\n[npm-image]: https://img.shields.io/npm/v/is-type-of.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/is-type-of\n[codecov-image]: https://codecov.io/github/node-modules/is-type-of/coverage.svg?branch=master\n[codecov-url]: https://codecov.io/github/node-modules/is-type-of?branch=master\n[snyk-image]: https://snyk.io/test/npm/is-type-of/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/is-type-of\n[download-image]: https://img.shields.io/npm/dm/is-type-of.svg?style=flat-square\n[download-url]: https://npmjs.org/package/is-type-of\n[node-version-image]: https://img.shields.io/node/v/is-type-of.svg?style=flat-square\n[node-version-url]: https://nodejs.org/en/download/\n\nComplete type checking for Node\n\n## Features\n\n- 🔒 Useful Type Checking，including Primitive, Standard Object, Node Object\n- ✨ Typescript Support\n- 🚪 Typescript Type Guard Support\n\n## Install\n\n```bash\nnpm install is-type-of\n```\n\n## Usage\n\nUse ES Module import\n\n```typescript\nimport is from 'is-type-of';\nimport { isArray } from 'is-type-of';\n\nisArray([]); // =\u003e true\nis.array([]); // =\u003e true\n```\n\nCompatible With\n\n```javascript\nconst is = require('is-type-of');\n\nis.array([1]); // =\u003e true\nis.primitive(true); // =\u003e true\nis.primitive({}); // =\u003e false\nis.generatorFunction(function * () {}); // =\u003e true\nis.long(Math.pow(2, 33)); // =\u003e true\nis.double(0); // =\u003e false\n```\n\nUse Type Guard\n\n```typescript\nimport { isArray } from 'is-type-of';\n\nfunction checkArray(arr: string[] | string) {\n  // =\u003e parameter) arr: string | string[]\n  if (isArray(arr)) {\n    // =\u003e (parameter) arr: string[]\n    arr.forEach(console.log);\n  }\n}\n```\n\n\n## API Document\n\n### Primitive\n\n#### isString\n\nReturns true if `val` is string, not `String` object.\n\nSee Also `is.string`\n\n#### isNumber\n\nReturns true if `val` is number, not `Number` object.\n\nSee Also `is.number`\n\n#### isBoolean\n\nReturns true if `val` is boolean, not `Boolean` object.\n\nSee Also `is.boolean`\n\n#### isBigInt\n\nReturns true if `val` is bigint.\n\nSee Also `is.bigInt`\n\n#### isSymbol\n\nReturns true if `val` is symbol.\n\nSee Also `is.symbol`\n\n#### isUndefined\n\nReturns true if `val` is undefined.\n\nSee Also `is.undefined`\n\n#### isNull\n\nReturns true if `val` is null.\n\nSee Also `is.null`\n\n#### isNullable\n\nReturns true if `val` is null or undefined.\n\nSee Also `is.nullable`\n\n#### isPrimitive\n\nReturns true if `val` is primitive.\n\nSee Also `is.primitive`\n\n#### isInteger\n\nReturns true if `val` is integer.\n\nSee Also `is.integer`\n\n#### isInteger32\n\nReturns true if `val` is integer, and between `-2 ** 31` and `2 ** 31 - 1`.\n\nSee Also `is.integer32`\n\n#### isLong\n\nReturns true if `val` is integer, and \u003c `-2 ** 31`, and \u003e `2 ** 31 - 1`.\n\nSee Also `is.long`\n\n#### isSafeInteger\n\nReturns true if `val` is integer, and between `-(2 ** 53 - 1)` and `2 ** 53 - 1`.\n\nSee Also `is.safeInteger`\n\n#### isDouble\n\nReturns true if `val` is Double.\n\nSee Also `is.double`\n\n#### isNaN\n\nReturns true if `val` is NaN.\n\nSee Also `is.NaN`\n\n#### isFinite\n\nReturns true if `val` is finite.\n\nSee Also `is.finite`\n\n### Standard Object\n# API Documentation\n\n#### isArray\n\nReturns true if `val` is array, it won't check items of array.\n\nSee Also `is.array`\n\n#### isFunction\n\nReturns true if `val` is function.\n\nSee Also `is.function`\n\n#### isGeneratorFunction\n\nReturns true if `val` is generator function.\n\nSee Also `is.generatorFunction`\n\n#### isAsyncFunction\n\nReturns true if `val` is async function.\n\nSee Also `is.asyncFunction`\n\n#### isAsyncGeneratorFunction\n\nReturns true if `val` is async generator function.\n\nSee Also `is.asyncGeneratorFunction`\n\n#### isObject\n\nReturns true if `val` is object.\n\nSee Also `is.object`\n\n#### isClass\n\nReturns true if `val` is class.\n\n**Note:** \"class\" is supported in ECMAScript 6, and if the code is using some compiler or transpiler, the checking might fail.\n\nSee Also `is.class`\n\n#### isRegExp\n\nReturns true if `val` is regular expression.\n\nSee Also `is.regExp`\n\n#### isDate\n\nReturns true if `val` is instance of Date.\n\nSee Also `is.date`\n\n#### isError\n\nReturns true if `val` is instance of Error.\n\nSee Also `is.error`\n\n#### isGenerator\n\nReturns true if `val` is generator.\n\nSee Also `is.generator`\n\n#### isPromise\n\nReturns true if `val` is promise.\n\nSee Also `is.promise`\n\n#### isPromiseLike\n\nReturns true if `val` is like promise, if the object has `then` property, the checking will pass.\n\nSee Also `is.promiseLike`\n\n### Node Object\n\n#### isBuffer\n\nReturns true if `val` is buffer.\n\nSee Also `is.buffer`\n\n#### isStream\n\nReturns true if `val` is stream.\n\nSee Also `is.stream`\n\n#### isReadable\n\nReturns true if `val` is readable stream.\n\nSee Also `is.readable`\n\n#### isWritable\n\nReturns true if `val` is write stream.\n\nSee Also `is.writable`\n\n#### isDuplex\n\nReturns true if `val` is duplex stream.\n\nSee Also `is.duplex`\n\n### External Object\n\n#### isLongObject\n\nreturns true if val is LongObject\n\nLongObject is from npm package [long](https://github.com/dcodeIO/long.js)\n\nSee Also `is.longObject`\n\n## Thanks\n\n- [core-util-is](https://github.com/isaacs/core-util-is)\n- [is-stream](https://github.com/rvagg/isstream)\n- [is-class](https://github.com/miguelmota/is-class)\n\n## License\n\n[MIT](LICENSE)\n\n## Contributors\n\n[![Contributors](https://contrib.rocks/image?repo=node-modules/is-type-of)](https://github.com/node-modules/is-type-of/graphs/contributors)\n\nMade with [contributors-img](https://contrib.rocks).\n","funding_links":[],"categories":["Repository"],"sub_categories":["Check/Detect"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-modules%2Fis-type-of","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnode-modules%2Fis-type-of","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-modules%2Fis-type-of/lists"}