{"_id":"@achrinza/strong-type","_rev":"2908401","name":"@achrinza/strong-type","description":"allows easy type enforcement for all JS types objects and classes. it is also extensible and provides simple to use type checks for your own custom classes and types","dist-tags":{"latest":"1.1.4","v0-latest":"0.1.10"},"maintainers":[{"name":"achrinza","email":"rifa@achrinza.com"}],"time":{"modified":"2023-01-13T06:24:12.000Z","created":"2022-03-25T10:21:51.248Z","1.1.4":"2022-10-23T05:57:50.378Z","0.1.10":"2022-10-23T05:54:41.662Z","1.1.3":"2022-10-23T01:54:28.518Z","0.1.9":"2022-10-23T01:50:13.786Z","1.1.2":"2022-08-22T09:32:05.140Z","0.1.8":"2022-08-22T09:22:35.840Z","0.1.7":"2022-03-25T10:51:40.433Z","1.1.1":"2022-03-25T10:21:51.248Z"},"users":{},"author":{"name":"Brandon Nozaki Miller"},"repository":{"type":"git","url":"git+https://github.com/achrinza/strong-type.git"},"versions":{"1.1.4":{"name":"@achrinza/strong-type","version":"1.1.4","type":"module","description":"allows easy type enforcement for all JS types objects and classes. it is also extensible and provides simple to use type checks for your own custom classes and types","main":"index.js","engines":{"node":"^12.21.0 || 14 || 15 || 16 || 17 || 18 || 19"},"publishConfig":{"access":"public"},"scripts":{"test":"c8 -r lcov -r html node test/CI.js && c8 report","start":"npm run emulate && node-http-server port=8000 verbose=true","emulate":"copyfiles -V \"./!(node_modules)/*\" \"./**!(node_modules)\"  \"./example/node_modules/@achrinza/strong-type/\" && copyfiles -V \"./node_modules/**/*\" \"./example/\" && copyfiles -V \"./!(node_modules)/*\" \"./**!(node_modules)\"","nodeExample":"node ./example/node/typecheck.js","coverage":"echo 'See your coverage report at http://localhost:8080' && node-http-server port=8080 root=./coverage/"},"repository":{"type":"git","url":"git+https://github.com/achrinza/strong-type.git"},"keywords":["strong","type","validation","validate","check","checking"],"author":{"name":"Brandon Nozaki Miller"},"license":"MIT","bugs":{"url":"https://github.com/achrinza/strong-type/issues"},"homepage":"https://github.com/achrinza/strong-type#readme","devDependencies":{"@node-ipc/vanilla-test":"1.4.12","c8":"^7.6.0","copyfiles":"^2.4.1","node-http-server":"8.1.5"},"gitHead":"5d966e5075c1c1c79d1013b06d2ccb48a6b2fa16","_id":"@achrinza/strong-type@1.1.4","_nodeVersion":"18.8.0","_npmVersion":"8.18.0","dist":{"shasum":"197230aa3bd04a863ee01934fd47bb37d34b0205","size":7056,"noattachment":false,"key":"/@achrinza/strong-type/-/@achrinza/strong-type-1.1.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/@achrinza/strong-type/download/@achrinza/strong-type-1.1.4.tgz"},"_npmUser":{"name":"achrinza","email":"rifa@achrinza.com"},"directories":{},"maintainers":[{"name":"achrinza","email":"rifa@achrinza.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/strong-type_1.1.4_1666504670196_0.8359582299349502"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-23T06:02:12.646Z","publish_time":1666504670378,"_cnpm_publish_time":1666504670378},"0.1.10":{"name":"@achrinza/strong-type","version":"0.1.10","type":"module","description":"allows easy type enforcement for all JS types objects and classes. it is also extensible and provides simple to use type checks for your own custom classes and types","main":"index.js","directories":{"example":"example"},"publishConfig":{"access":"public","tag":"v0-latest"},"engines":{"node":"12 || 13 || 14 || 15 || 16 || 17 || 18 || 19"},"scripts":{"test":"npm run emulate && node ./test/CI.js","start":"npm run emulate && node-http-server port=8000 verbose=true","emulate":"copyfiles -V \"./!(node_modules)/*\" \"./**!(node_modules)\"  \"./example/node_modules/@achrinza/strong-type/\" && copyfiles -V \"./node_modules/**/*\" \"./example/\" && copyfiles -V \"./!(node_modules)/*\" \"./**!(node_modules)\"  \"./test/node_modules/@achrinza/strong-type/\" && copyfiles -V \"./node_modules/**/*\" \"./test/\"","nodeExample":"node ./example/node/typecheck.js"},"repository":{"type":"git","url":"git+https://github.com/achrinza/strong-type.git"},"keywords":["strong","type","validation","validate","check","checking"],"author":{"name":"Brandon Nozaki Miller"},"license":"MIT","bugs":{"url":"https://github.com/achrinza/strong-type/issues"},"homepage":"https://github.com/achrinza/strong-type#readme","devDependencies":{"@node-ipc/vanilla-test":"1.4.12","copyfiles":"2.4.1","node-http-server":"8.1.5"},"readmeFilename":"README.md","gitHead":"8ec3adcc657221cee50c2961dc961a07982150b8","_id":"@achrinza/strong-type@0.1.10","_nodeVersion":"18.8.0","_npmVersion":"8.18.0","dist":{"shasum":"8d15e63c29fd2ee1361520c7035d671118300df3","size":6355,"noattachment":false,"key":"/@achrinza/strong-type/-/@achrinza/strong-type-0.1.10.tgz","tarball":"http://registry.cnpm.dingdandao.com/@achrinza/strong-type/download/@achrinza/strong-type-0.1.10.tgz"},"_npmUser":{"name":"achrinza","email":"rifa@achrinza.com"},"maintainers":[{"name":"achrinza","email":"rifa@achrinza.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/strong-type_0.1.10_1666504481447_0.08560173338458332"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-23T06:02:11.939Z","publish_time":1666504481662,"_cnpm_publish_time":1666504481662},"1.1.3":{"name":"@achrinza/strong-type","version":"1.1.3","type":"module","description":"allows easy type enforcement for all JS types objects and classes. it is also extensible and provides simple to use type checks for your own custom classes and types","main":"index.js","engines":{"node":"^12.21.0 || 14 || 15 || 16 || 17 || 18 || 19"},"publishConfig":{"access":"public"},"scripts":{"test":"c8 -r lcov -r html node test/CI.js && c8 report","start":"npm run emulate && node-http-server port=8000 verbose=true","emulate":"copyfiles -V \"./!(node_modules)/*\" \"./**!(node_modules)\"  \"./example/node_modules/@achrinza/strong-type/\" && copyfiles -V \"./node_modules/**/*\" \"./example/\" && copyfiles -V \"./!(node_modules)/*\" \"./**!(node_modules)\"","nodeExample":"node ./example/node/typecheck.js","coverage":"echo 'See your coverage report at http://localhost:8080' && node-http-server port=8080 root=./coverage/"},"repository":{"type":"git","url":"git+https://github.com/achrinza/strong-type.git"},"keywords":["strong","type","validation","validate","check","checking"],"author":{"name":"Brandon Nozaki Miller"},"license":"MIT","bugs":{"url":"https://github.com/achrinza/strong-type/issues"},"homepage":"https://github.com/achrinza/strong-type#readme","devDependencies":{"c8":"^7.6.0","copyfiles":"^2.4.1","node-http-server":"8.1.5","@node-ipc/vanilla-test":"1.4.9"},"gitHead":"fad005a09c89b56b0a3cb1db1f9c0c2b72d7b27e","_id":"@achrinza/strong-type@1.1.3","_nodeVersion":"18.8.0","_npmVersion":"8.18.0","dist":{"shasum":"6343dc773e82e6173f468104a927649b69cab913","size":7055,"noattachment":false,"key":"/@achrinza/strong-type/-/@achrinza/strong-type-1.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/@achrinza/strong-type/download/@achrinza/strong-type-1.1.3.tgz"},"_npmUser":{"name":"achrinza","email":"rifa@achrinza.com"},"directories":{},"maintainers":[{"name":"achrinza","email":"rifa@achrinza.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/strong-type_1.1.3_1666490068338_0.31610317261064247"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-23T02:01:40.406Z","publish_time":1666490068518,"_cnpm_publish_time":1666490068518},"0.1.9":{"name":"@achrinza/strong-type","version":"0.1.9","type":"module","description":"allows easy type enforcement for all JS types objects and classes. it is also extensible and provides simple to use type checks for your own custom classes and types","main":"index.js","directories":{"example":"example"},"publishConfig":{"access":"public","tag":"v0-latest"},"engines":{"node":"12 || 13 || 14 || 15 || 16 || 17 || 18 || 19"},"scripts":{"test":"npm run emulate && node ./test/CI.js","start":"npm run emulate && node-http-server port=8000 verbose=true","emulate":"copyfiles -V \"./!(node_modules)/*\" \"./**!(node_modules)\"  \"./example/node_modules/@achrinza/strong-type/\" && copyfiles -V \"./node_modules/**/*\" \"./example/\" && copyfiles -V \"./!(node_modules)/*\" \"./**!(node_modules)\"  \"./test/node_modules/@achrinza/strong-type/\" && copyfiles -V \"./node_modules/**/*\" \"./test/\"","nodeExample":"node ./example/node/typecheck.js"},"repository":{"type":"git","url":"git+https://github.com/achrinza/strong-type.git"},"keywords":["strong","type","validation","validate","check","checking"],"author":{"name":"Brandon Nozaki Miller"},"license":"MIT","bugs":{"url":"https://github.com/achrinza/strong-type/issues"},"homepage":"https://github.com/achrinza/strong-type#readme","dependencies":{},"devDependencies":{"copyfiles":"2.4.1","node-http-server":"8.1.5","@node-ipc/vanilla-test":"1.4.9"},"readmeFilename":"README.md","gitHead":"8b236857d4b3be006b8cf2260517cc37d98d55cd","_id":"@achrinza/strong-type@0.1.9","_nodeVersion":"18.8.0","_npmVersion":"8.18.0","dist":{"shasum":"85320dbef391cb85db56b9a6f8bb3c3d909e79b7","size":6361,"noattachment":false,"key":"/@achrinza/strong-type/-/@achrinza/strong-type-0.1.9.tgz","tarball":"http://registry.cnpm.dingdandao.com/@achrinza/strong-type/download/@achrinza/strong-type-0.1.9.tgz"},"_npmUser":{"name":"achrinza","email":"rifa@achrinza.com"},"maintainers":[{"name":"achrinza","email":"rifa@achrinza.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/strong-type_0.1.9_1666489813608_0.016029561457853392"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-10-23T02:01:39.394Z","publish_time":1666489813786,"_cnpm_publish_time":1666489813786},"1.1.2":{"name":"@achrinza/strong-type","version":"1.1.2","type":"module","description":"allows easy type enforcement for all JS types objects and classes. it is also extensible and provides simple to use type checks for your own custom classes and types","main":"index.js","engines":{"node":"^12.21.0 || 14 || 15 || 16 || 17 || 18"},"publishConfig":{"access":"public"},"scripts":{"test":"c8 -r lcov -r html node test/CI.js && c8 report","start":"npm run emulate && node-http-server port=8000 verbose=true","emulate":"copyfiles -V \"./!(node_modules)/*\" \"./**!(node_modules)\"  \"./example/node_modules/@achrinza/strong-type/\" && copyfiles -V \"./node_modules/**/*\" \"./example/\" && copyfiles -V \"./!(node_modules)/*\" \"./**!(node_modules)\"","nodeExample":"node ./example/node/typecheck.js","coverage":"echo 'See your coverage report at http://localhost:8080' && node-http-server port=8080 root=./coverage/"},"repository":{"type":"git","url":"git+https://github.com/achrinza/strong-type.git"},"keywords":["strong","type","validation","validate","check","checking"],"author":{"name":"Brandon Nozaki Miller"},"license":"MIT","bugs":{"url":"https://github.com/achrinza/strong-type/issues"},"homepage":"https://github.com/achrinza/strong-type#readme","devDependencies":{"c8":"^7.6.0","copyfiles":"^2.4.1","node-http-server":"8.1.5","@node-ipc/vanilla-test":"1.4.9"},"gitHead":"e24153ec893d6a94054a740841b0c1d76a078c6d","_id":"@achrinza/strong-type@1.1.2","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"shasum":"6db0b151afa4bbcf1f065f5cd7fab8da156a8d35","size":7052,"noattachment":false,"key":"/@achrinza/strong-type/-/@achrinza/strong-type-1.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/@achrinza/strong-type/download/@achrinza/strong-type-1.1.2.tgz"},"_npmUser":{"name":"achrinza","email":"rifa@achrinza.com"},"directories":{},"maintainers":[{"name":"achrinza","email":"rifa@achrinza.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/strong-type_1.1.2_1661160724959_0.4624937828413749"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-08-22T09:50:44.263Z","publish_time":1661160725140,"_cnpm_publish_time":1661160725140},"0.1.8":{"name":"@achrinza/strong-type","version":"0.1.8","type":"module","description":"allows easy type enforcement for all JS types objects and classes. it is also extensible and provides simple to use type checks for your own custom classes and types","main":"index.js","directories":{"example":"example"},"publishConfig":{"access":"public","tag":"v0-latest"},"engines":{"node":"12 || 13 || 14 || 15 || 16 || 17 || 18"},"scripts":{"test":"npm run emulate && node ./test/CI.js","start":"npm run emulate && node-http-server port=8000 verbose=true","emulate":"copyfiles -V \"./!(node_modules)/*\" \"./**!(node_modules)\"  \"./example/node_modules/@achrinza/strong-type/\" && copyfiles -V \"./node_modules/**/*\" \"./example/\" && copyfiles -V \"./!(node_modules)/*\" \"./**!(node_modules)\"  \"./test/node_modules/@achrinza/strong-type/\" && copyfiles -V \"./node_modules/**/*\" \"./test/\"","nodeExample":"node ./example/node/typecheck.js"},"repository":{"type":"git","url":"git+https://github.com/achrinza/strong-type.git"},"keywords":["strong","type","validation","validate","check","checking"],"author":{"name":"Brandon Nozaki Miller"},"license":"MIT","bugs":{"url":"https://github.com/achrinza/strong-type/issues"},"homepage":"https://github.com/achrinza/strong-type#readme","dependencies":{},"devDependencies":{"copyfiles":"2.4.1","node-http-server":"8.1.5","@node-ipc/vanilla-test":"1.4.9"},"readmeFilename":"README.md","gitHead":"16c02e2ee1d806dabf79826306216f2509388626","_id":"@achrinza/strong-type@0.1.8","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"shasum":"5c6ed9d3c1dc716df189e3da374ab2fffb625a46","size":6354,"noattachment":false,"key":"/@achrinza/strong-type/-/@achrinza/strong-type-0.1.8.tgz","tarball":"http://registry.cnpm.dingdandao.com/@achrinza/strong-type/download/@achrinza/strong-type-0.1.8.tgz"},"_npmUser":{"name":"achrinza","email":"rifa@achrinza.com"},"maintainers":[{"name":"achrinza","email":"rifa@achrinza.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/strong-type_0.1.8_1661160155719_0.8174023498665546"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-08-22T09:50:43.134Z","publish_time":1661160155840,"_cnpm_publish_time":1661160155840},"0.1.7":{"name":"@achrinza/strong-type","version":"0.1.7","type":"module","description":"allows easy type enforcement for all JS types objects and classes. it is also extensible and provides simple to use type checks for your own custom classes and types","main":"index.js","directories":{"example":"example"},"publishConfig":{"access":"public","tag":"v0-latest"},"engines":{"node":"12 || 13 || 14 || 15 || 16 || 17"},"scripts":{"test":"npm run emulate && node ./test/CI.js","start":"npm run emulate && node-http-server port=8000 verbose=true","emulate":"copyfiles -V \"./!(node_modules)/*\" \"./**!(node_modules)\"  \"./example/node_modules/@achrinza/strong-type/\" && copyfiles -V \"./node_modules/**/*\" \"./example/\" && copyfiles -V \"./!(node_modules)/*\" \"./**!(node_modules)\"  \"./test/node_modules/@achrinza/strong-type/\" && copyfiles -V \"./node_modules/**/*\" \"./test/\"","nodeExample":"node ./example/node/typecheck.js"},"repository":{"type":"git","url":"git+https://github.com/achrinza/strong-type.git"},"keywords":["strong","type","validation","validate","check","checking"],"author":{"name":"Brandon Nozaki Miller"},"license":"MIT","bugs":{"url":"https://github.com/achrinza/strong-type/issues"},"homepage":"https://github.com/achrinza/strong-type#readme","dependencies":{},"devDependencies":{"copyfiles":"2.4.1","node-http-server":"8.1.5","@node-ipc/vanilla-test":"1.4.9"},"readmeFilename":"README.md","gitHead":"1d0311d7d0fc730115ab17bb0911d5b77217bb1d","_id":"@achrinza/strong-type@0.1.7","_nodeVersion":"16.14.0","_npmVersion":"8.3.1","dist":{"shasum":"3ec6b34ff8a268515217a5fffc811e731213af34","size":6354,"noattachment":false,"key":"/@achrinza/strong-type/-/@achrinza/strong-type-0.1.7.tgz","tarball":"http://registry.cnpm.dingdandao.com/@achrinza/strong-type/download/@achrinza/strong-type-0.1.7.tgz"},"_npmUser":{"name":"achrinza","email":"rifa@achrinza.com"},"maintainers":[{"name":"achrinza","email":"rifa@achrinza.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/strong-type_0.1.7_1648205500279_0.2204922935596243"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-03-25T11:12:06.717Z","publish_time":1648205500433,"_cnpm_publish_time":1648205500433},"1.1.1":{"name":"@achrinza/strong-type","version":"1.1.1","type":"module","description":"allows easy type enforcement for all JS types objects and classes. it is also extensible and provides simple to use type checks for your own custom classes and types","main":"index.js","engines":{"node":"^12.21.0 || 14 || 15 || 16 || 17"},"publishConfig":{"access":"public"},"scripts":{"test":"c8 -r lcov -r html node test/CI.js && c8 report","start":"npm run emulate && node-http-server port=8000 verbose=true","emulate":"copyfiles -V \"./!(node_modules)/*\" \"./**!(node_modules)\"  \"./example/node_modules/@achrinza/strong-type/\" && copyfiles -V \"./node_modules/**/*\" \"./example/\" && copyfiles -V \"./!(node_modules)/*\" \"./**!(node_modules)\"","nodeExample":"node ./example/node/typecheck.js","coverage":"echo 'See your coverage report at http://localhost:8080' && node-http-server port=8080 root=./coverage/"},"repository":{"type":"git","url":"git+https://github.com/achrinza/strong-type.git"},"keywords":["strong","type","validation","validate","check","checking"],"author":{"name":"Brandon Nozaki Miller"},"license":"MIT","bugs":{"url":"https://github.com/achrinza/strong-type/issues"},"homepage":"https://github.com/achrinza/strong-type#readme","devDependencies":{"c8":"^7.6.0","copyfiles":"^2.4.1","node-http-server":"8.1.5","@node-ipc/vanilla-test":"1.4.9"},"gitHead":"c44167a3d3e0781d2de95c8be52d81e5696e7b0f","_id":"@achrinza/strong-type@1.1.1","_nodeVersion":"16.14.0","_npmVersion":"8.3.1","dist":{"shasum":"57771b376e21e9032139c8f8dfd85f2b8e925f91","size":7047,"noattachment":false,"key":"/@achrinza/strong-type/-/@achrinza/strong-type-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@achrinza/strong-type/download/@achrinza/strong-type-1.1.1.tgz"},"_npmUser":{"name":"achrinza","email":"rifa@achrinza.com"},"directories":{},"maintainers":[{"name":"achrinza","email":"rifa@achrinza.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/strong-type_1.1.1_1648203711088_0.06945237049515618"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-03-25T10:36:11.815Z","publish_time":1648203711248,"_cnpm_publish_time":1648203711248}},"readme":"# @achrinza/strong-type\n\n## Strongly Typed native JS without a hard requirement for transpiling.\n\nWhat TypeScript should have been. `@achrinza/strong-type` will also work in TypeScript.\n\nType checking module for anywhere javascript can run ES6 modules. This includes node, electron and the browsers. Fully isomorphic. Unlike other solutions like TypeScript, `@achrinza/strong-type` works natively and does not require transpiling or bundling unless you want to. This make it inclusive of any framework transpiled or not.\n\n` npm install --save @achrinza/strong-type `  \n\n## What does @achrinza/strong-type do?\n`@achrinza/strong-type` allows easy type enforcement for all JS types objects and classes. It also supports `type unions` for multiple types, as well as special types like `.any` and `.defined`. It is also extensible and provides simple to use type checks for your own custom classes and types should you want to use them.\n\nIt does all this without requiring any additional tooling or transpiling. This leaves you or your organization free to use whatever toolchain or framework you want, or even... to write vanilla native JS.\n\n## Testing and Coverage\n\n`@achrinza/strong-type` is tested using [`@node-ipc/vanilla-test`](https://github.com/node-ipc/vanilla-test) which is a bare bones testing framework for js that supports ESM, and covered by [`C8`](https://github.com/bcoe/c8) which is the default coverage tool built into the node runtime. This pair is the most effective and accurate way to test ES6+ modules.\n\nRun the tests and build the coverage files on your local machine by running `node-test` or see the coverage files on the [@achrinza/strong-type CDN home](https://cdn-p939v.ondigitalocean.app/@achrinza/strong-type/) : https://cdn-p939v.ondigitalocean.app/@achrinza/strong-type/ \n\n## Example | strict vs. non-strict\n\nUsing `strict` and `non-strict` modes. By default `@achrinza/strong-type` runs `strict` and will `throw` a verbose err you can handle and use if the check fails, or return true if it passes.\n\nTo use `non-strict` mode, simply pass `false` to the constructor. In this mode, `@achrinza/strong-type` will return `false` instead of throwing when the check fails, and will still return `true` when it passes.\n\n\n#### strict\n```javascript \nimport Is from '@achrinza/strong-type';\n\n//strict\nconst is = new Is;\nconst is = new Is();\nconst is = new Is(true);\n\n//throws\nis.string(1);\n\n//union or multiple possible types\n//should not throw\nis.union(1,'string|number');\n\n//union or multiple possible types\n//should throw\nfunction check(any){\n    is.defined(any);\n}\n\n```\n\n#### non-strict\n```javascript\nimport Is from '@achrinza/strong-type';\n\n//non-strict\nconst is = new Is(false);\n\n//returns false\nis.string(1);\n\n//union or multiple possible types\n//should return true\nis.union(1,'string|number');\n\n```\n\n## Type check methods \n\nAll of these methods take just one arg, the `value` to check. \n\nUnions can join any of the types supported by `Is`.\n\n|Union|args|\n|-|-|\n|`is.union`|`value`,`pipe\\|seperated\\|type\\|list`|\n\n|Most Common Type Methods|args|\n|-|-|\n|`is.globalThis`|`value`|\n|`is.array`|`value`|\n|`is.bigint`|`value`|\n|`is.boolean`|`value`|\n|`is.date`|`value`|\n|`is.finite`|`value`|\n|`is.generator`|`value`|\n|`is.asyncGenerator`|`value`|\n|`is.infinity`|`value`|\n|`is.map`|`value`|\n|`is.NaN`|`value`|\n|`is.null`|`value`|\n|`is.number`|`value`|\n|`is.object`|`value`|\n|`is.promise`|`value`|\n|`is.regExp`|`value`|\n|`is.set`|`value`|\n|`is.string`|`value`|\n|`is.symbol`|`value`|\n|`is.undefined`|`value`|\n|`is.weakMap`|`value`|\n|`is.weakSet`|`value`|\n\n|Function Type Methods|args|\n|-|-|\n|`is.function`|`value`|\n|`is.asyncFunction`|`value`|\n|`is.generatorFunction`|`value`|\n|`is.asyncGeneratorFunction`|`value`|\n\n|Error Type Methods|args|\n|-|-|\n|`is.error`|`value`|\n|`is.evalError`|`value`|\n|`is.rangeError`|`value`|\n|`is.referenceError`|`value`|\n|`is.syntaxError`|`value`|\n|`is.typeError`|`value`|\n|`is.URIError`|`value`|\n\n|Buffer/Typed Array Type Methods|args|\n|-|-|\n|`is.arrayBuffer`|`value`|\n|`is.dataView`|`value`|\n|`is.sharedArrayBuffer`|`value`|\n|`is.bigInt64Array`|`value`|\n|`is.bigUint64Array`|`value`|\n|`is.float32Array`|`value`|\n|`is.float64Array`|`value`|\n|`is.int8Array`|`value`|\n|`is.int16Array`|`value`|\n|`is.int32Array`|`value`|\n|`is.uint8Array`|`value`|\n|`is.uint8ClampedArray`|`value`|\n|`is.uint16Array`|`value`|\n|`is.uint32Array`|`value`|\n\n|Intl Type Methods|args|\n|-|-|\n|`is.intlDateTimeFormat`|`value`|\n|`is.intlCollator`|`value`|\n|`is.intlDisplayNames`|`value`|\n|`is.intlListFormat`|`value`|\n|`is.intlLocale`|`value`|\n|`is.intlNumberFormat`|`value`|\n|`is.intlPluralRules`|`value`|\n|`is.intlRelativeTimeFormat`|`value`|\n\n|Garbage Collection Type Methods|args|\n|-|-|\n|`is.finalizationRegistry`|`value`|\n|`is.weakRef`|`value`|\n\n## Core methods \n\nYou can use these to directly check your own types / classes Or extend the Is class to add your own methods in which you use these for checking more types, especially custom types and classes.\n\n|Method|args|description|\n|-|-|-|\n|`is.throw`|`valueType`, `expectedType`| this will use the valueType and expectedValueType to create and throw a new `TypeError` |\n|`is.typeCheck`|`value`, `type`| this will check the javascript spec types returned from `typeof`. So the `type` arg would be a string of `'string'`, `'boolean'`, `'number'`, `'object'`, `'undefined'`, `'bigint'` etc. |\n|`is.instanceCheck`|`value`=`new Fake`, `constructor`=`FakeCore`| The core defaults the args to a `Fake` instance and the `FakeCore` class. This allows unsupported js spec types to fail as expected with a `TypeError` instead of a `Reference` or other Error (see the `./example/web/` example in firefox which is missing some support for `Intl` classes). This method compares `value` with the `constructor` to insure the value is an `instanceof` the constructor. |\n|`is.symbolStringCheck`|`value`, `type`| This can be used to check the `Symbol.toStringTag` it works on all types, but in the core we only use it to check `generator`, `GeneratorFunction`, `async function`, and `async GeneratorFunction` as these have no other way to check their type. A generator ***for example*** has a type of `[object generator]` this way. So you pass in an expected `generator` as `value` and the string `'generator'` as the type, and we handle the rest including lowercasing everything to insure cross browser and platform checking |\n|`is.compare`|`value`, `targetValue`, `typeName`| this will do an explicit compare on the `value` and `targetValue`. In the core, we only use this for JS primitives/constants that have no other way to check such as `Infinity` and `globalThis`. The type name is the string representation of the class type, or a very explicit error string as the only place this arg is ever used is when the `compare` results in a `throws`. |\n|`is.defined`|`value`| this will check that a value is not `is.undefined` any type is valid except `undefined`. |\n|`is.any`|`value`| this is an alias to `is.defined` which will allow any type except `undefined`.|\n|`is.exists`|`value`| this is an alias to `is.defined` to determine if something exists. Very useful for feature testing. The alias was created for simplicity and transparency.|\n\n\n## Example | Basic type checking\n\n`@achrinza/strong-type` is intended to be very simple to use.\n\n```javascript \nimport Is from '@achrinza/strong-type';\n\n//strict\nconst is = new Is;\n\nfunction strongTypeRequired(aNumber,aString,anAsyncFunction){\n    is.number(aNumber);\n    is.string(aString);\n    is.asyncFunction(anAsyncFunction);\n}\n\nfunction unionStrongTypeRequired(aNumberOrString){\n    is.union(aNumberOrString,'number|string');\n}\n\n\n//this will throw because we do not pass an async Function, but rather a normal function.\nstrongTypeRequired(1,'a',function(){})\n\n//these will both pass because we accept both types in a union for the first param. \nunionStrongTypeRequired(1);\nunionStrongTypeRequired('a');\n\n\n```\n#### browser\n![Basic Type Checking Example Web](https://raw.githubusercontent.com/achrinza/strong-type/main/docs/img/basicExampleWeb.PNG)\n\n#### node\n![Basic Type Checking Example Node](https://raw.githubusercontent.com/achrinza/strong-type/main/docs/img/basicExampleNode.PNG)\n\n## Example | Generator type checking\n\nGenerators are notoriously confusing to type check for many devs. This is why we chose to use them as an example.\n\n```javascript \nimport Is from '@achrinza/strong-type';\n\n//strict\nconst is = new Is;\n\n//empty generator for this example's sake\nfunction* myGenFunc(){};\nconst myGen=myGenFunc();\n\n//we'll show async as well\nasync function* myAsyncGenFunc(){}\nconst myAsyncGen=myAsyncGenFunc();\n\n//empty function\nfunction myFunc(){};\n\n//will pass and allow contunue\nis.generator(myGen);\n\n/*\nwill fail because a generatorFunction is a \nGeneratorFunction, not a Generator\n*/\ntry{\n    is.generator(myGenFunc);\n}catch(err){\n    console.log(err);\n}\n\n//will pass and allow contunue\nis.generatorFunction(myGenFunc);\n\n//will fail because a function is not a generatorFunction\ntry{\n    is.generatorFunction(myFunc);\n}catch(err){\n    console.log(err);\n}\n\n/*\nwill fail because this is @achrinza/strong-type, a \ngeneratorFunction is explicitly a GeneratorFunction,\nand not a Function\n*/\ntry{\n    is.function(myGenFunc);\n}catch(err){\n    console.log(err);\n}\n\n//will fail because a function is not a generatorFunction\ntry{\n    is.generatorFunction(myFunc);\n}catch(err){\n    console.log(err);\n}\n\n//will pass and allow contunue\nis.asyncGeneratorFunction(myAsyncGenFunc);\n\n//will pass and allow contunue\nis.asyncGenerator(myAsyncGen);\n\n/*\nwill fail becase @achrinza/strong-type \nasyncGenerators and generators are explicitly different\nthis is the same for generatorFunctions and functions\n*/\ntry{\n    is.asyncGenerator(myGen);\n}catch(err){\n    console.log(err);\n}\n\ntry{\n    is.generator(myAsyncGen);\n}catch(err){\n    console.log(err);\n}\n\n\n```\n\n#### browser\n![Generator Type Checking Example Web](https://raw.githubusercontent.com/achrinza/strong-type/main/docs/img/generatorExampleWeb.PNG)\n\n#### node\n![Generator Type Checking Example Node](https://raw.githubusercontent.com/achrinza/strong-type/main/docs/img/generatorExampleNode.PNG)\n\n## Date example\n\n```javascript \nimport Is from '@achrinza/strong-type';\n\nconst is = new Is;\n\n//returns true\nis.date(new Date()); \n\n//throws in strict or returns false in non-strict\nis.date(1975);\n\n```\n\n## isNaN() vs is.NaN()\n\nJavascripts types are weak by nature, so the built in `isNaN()` function returns true for anything that not a number, but `is.NaN()` only returns true if it is explicitly passed `NaN`.\n\n```js \nimport Is from '@achrinza/strong-type';\n\nconst is = new Is;\n\n//built in JS isNaN\n//returns false\nisNaN(1);\n\n//all return true\nisNaN(NaN);\nisNaN(undefined);\nisNaN('a'); \n\n//@achrinza/strong-type is.NaN all return false in non-strict mode,\n//or throw in default strict mode\nis.NaN(1);\nis.NaN(undefined);\nis.NaN('a');\n\n//in @achrinza/strong-type only this returns true\nis.NaN(NaN);\n\n```\n\n#### browser\n![Date Type Checking Example Web](https://raw.githubusercontent.com/achrinza/strong-type/main/docs/img/dateExampleWeb.PNG)\n\n#### node\n![Date Type Checking Example Node](https://raw.githubusercontent.com/achrinza/strong-type/main/docs/img/dateExampleNode.PNG)\n\n\n\n## Running the browser and node type support examples\nrun `npm i` in the root dir of this module to make sure you get the devDependencies installed.\n\n#### node example :  \n`npm run nodeExample` The whole screen should be green as all of the types are supported in node.\n\n#### browser examples and support tests\n`npm start`  \nthis will spin up a `node-http-server` in this modules root on port 8000. The browser examples are in the  `./example/web/` folder. You can see them by going to this local address : [http://localhost:8000/](http://localhost:8000/example/web/index.html)\n\nChrome, Opera, and Edge support all the types so all rows will be green.\n\nYou will see some red rows in Firefox as it does not yet support all types. The unsupported types will throw type errors when checked/validated.\n\n#### Digital Ocean Static App\n\nWe use the free Digital Ocean Static Apps to host a version of the local server. It is exactly the same as if you ran `npm start` on your machine. You can also use this like a CDN as it automatically rebuilds from main/master each time the branch is updated. [@achrinza/strong-type CDN home](https://cdn-p939v.ondigitalocean.app/@achrinza/strong-type/) : https://cdn-p939v.ondigitalocean.app/@achrinza/strong-type/\n\n\n## Extending the Is class for your own Types\n\nIf you are using type checking on your own types in production, its probably wise for yout to just go ahead and extend the module rather than calling the more cumbersome `Core Methods` many times.\n\n#### custom Pizza type\n```javascript\n//custom class type constructor\nclass Pizza{\n    constructor(topping){\n        this.eat=true;\n    }\n}\n\nexport {default:Pizza, Pizza}\n```\n\n#### extension\n```javascript\nimport Is from '@achrinza/strong-type';\nimport Pizza from 'my-delicious-pizza';\n\nclass IsMy extends Is{\n    //custom pizza type\n    pizza(value){\n        return this.instanceCheck(value,Pizza);\n    }\n}\n\nexport={default:IsMy, IsMy};\n```\n\n#### test\n```javascript\nimport IsMy from 'my-delicious-typechecks';\nimport Pizza from 'my-delicious-pizza';\n\nconst is=new IsMy;\n\n//will throw because 42 is not a Pizza Type\n//and \nis.pizza(42)\n\n```\n\n#### browser\n![Pizza Type Checking Example Web](https://raw.githubusercontent.com/achrinza/strong-type/main/docs/img/pizzaExampleWeb.PNG)\n\n#### node\n![Pizza Type Checking Example Node](https://raw.githubusercontent.com/achrinza/strong-type/main/docs/img/pizzaExampleNode.PNG)\n\n","_attachments":{},"homepage":"https://github.com/achrinza/strong-type#readme","bugs":{"url":"https://github.com/achrinza/strong-type/issues"},"license":"MIT"}