{"name":"is-type-of","version":"2.2.0","description":"complete type checking for node","type":"module","tshy":{"exports":{"./package.json":"./package.json",".":"./src/index.ts"}},"exports":{"./package.json":"./package.json",".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}}},"scripts":{"prepublishOnly":"tshy && tshy-after","test":"egg-bin test","ci":"npm run lint && egg-bin cov && npm run prepublishOnly","lint":"eslint . --ext .ts"},"repository":{"type":"git","url":"git://github.com/node-modules/is-type-of.git"},"node":{"engines":">= 16.0.0"},"keywords":["typeof","checker","type","is"],"author":{"name":"dead_horse","email":"dead_horse@qq.com"},"license":"MIT","bugs":{"url":"https://github.com/node-modules/is-type-of/issues"},"homepage":"https://github.com/node-modules/is-type-of","devDependencies":{"@eggjs/tsconfig":"^1.3.3","@types/mocha":"^10.0.1","@types/node":"^20.6.1","beautify-benchmark":"^0.2.4","benchmark":"^2.1.4","core-util-is":"^1.0.3","egg-bin":"^6.5.2","eslint":"^8.54.0","eslint-config-egg":"^13.0.0","long":"^3.2.0","semver":"^7.6.3","ts-expect":"^1.3.0","tshy":"^3.0.2","tshy-after":"^1.0.0","typescript":"^5.2.2"},"types":"./dist/commonjs/index.d.ts","main":"./dist/commonjs/index.js","module":"./dist/esm/index.js","_id":"is-type-of@2.2.0","gitHead":"f877e5e1219428bd2a4a6901048991e0a22aa200","_nodeVersion":"18.20.5","_npmVersion":"10.8.2","dist":{"integrity":"sha512-72axShMJMnMy5HSU/jLGNOonZD5rWM0MwJSCYpKCTQCbggQZBJO/CLMMVP5HgS8kPSYFBkTysJexsD6NMvGKDQ==","shasum":"c1c330e7bf890d332c20e56006fcc39b91925d0e","tarball":"http://registry-npm.ywwl.com/is-type-of/download/is-type-of-2.2.0.tgz","fileCount":41,"unpackedSize":107900,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/is-type-of@2.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGdIb2NaqGbaJ3D7UEa6LOFtegtbSK52lRFSkfXUIVjUAiEAgdp4XijW7U5JZ37Jml+o6ifpYCaw4sBQiU3zpq0lbqM="}],"size":18329,"noattachment":false,"key":"/is-type-of/-/is-type-of-2.2.0.tgz"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/is-type-of_2.2.0_1733718024578_0.24192136375165263"},"_hasShrinkwrap":false,"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([]); // => true\nis.array([]); // => true\n```\n\nCompatible With\n\n```javascript\nconst is = require('is-type-of');\n\nis.array([1]); // => true\nis.primitive(true); // => true\nis.primitive({}); // => false\nis.generatorFunction(function * () {}); // => true\nis.long(Math.pow(2, 33)); // => true\nis.double(0); // => false\n```\n\nUse Type Guard\n\n```typescript\nimport { isArray } from 'is-type-of';\n\nfunction checkArray(arr: string[] | string) {\n  // => parameter) arr: string | string[]\n  if (isArray(arr)) {\n    // => (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 < `-2 ** 31`, and > `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","publish_time":1733718024777,"maintainers":[{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"}],"_cnpm_publish_time":1733718024777,"dist-tags":{"latest":"2.2.0","release-1.x":"1.4.0"}}