{"_id":"@nbsh/to-type","_rev":"1049279","name":"@nbsh/to-type","description":"Fixes JavaScript typeof operator using Symbol.toStringTag","dist-tags":{"latest":"5.0.0-next.1","next":"5.0.0-next.1"},"maintainers":[{"name":"rannn505","email":"rannn505@outlook.com"}],"time":{"modified":"2024-09-18T08:05:13.000Z","created":"2020-05-12T00:23:05.709Z","5.0.0-next.1":"2020-05-12T00:23:05.709Z"},"users":{},"author":{"name":"Ran Cohen","email":"rannn505@outlook.com"},"repository":{"type":"git","url":"git+https://github.com/rannn505/node-powershell.git","directory":"packages/to-type"},"versions":{"5.0.0-next.1":{"name":"@nbsh/to-type","version":"5.0.0-next.1","description":"Fixes JavaScript typeof operator using Symbol.toStringTag","author":{"name":"Ran Cohen","email":"rannn505@outlook.com"},"homepage":"http://rannn505.github.io/node-powershell/tree/master/toType#readme","license":"MIT","main":"dist","types":"dist","directories":{"doc":"doc","lib":"lib","test":"test"},"repository":{"type":"git","url":"git+https://github.com/rannn505/node-powershell.git","directory":"packages/to-type"},"scripts":{},"bugs":{"url":"https://github.com/rannn505/node-powershell/issues"},"publishConfig":{"access":"public"},"gitHead":"b2fa4f408d7ed1685f74b068b2018792e98dcd93","_id":"@nbsh/to-type@5.0.0-next.1","_nodeVersion":"10.16.0","_npmVersion":"lerna/3.20.2/node@v10.16.0+x64 (darwin)","dist":{"integrity":"sha512-NQsA9nEWzzOAhXgRs2fqCsV0Q1KkiW5KNcVCrWqYSiJjFYkoZoQjLSE/6f09r8Qwyd3MoYgig7H7/j6J3kE65w==","shasum":"dd9e14b09f9e1af7555fba6b0fedd10b9c95f858","tarball":"http://registry-npm.ywwl.com/@nbsh/to-type/download/@nbsh/to-type-5.0.0-next.1.tgz","fileCount":6,"unpackedSize":5779,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeuexqCRA9TVsSAnZWagAA4V4P/0aW2WEOmC2DVWxuxn9M\ns+J2sQ96If6fTvvo/XEuRAj75yZKfFdzgbOOHRMh0c55cFthtLSmR2DOxPBb\n7yJaa7kPYoQF4/98dlPf9HmeOel9ZI234hKaLVFjVCUU82gohQKqtWNvBWMI\nVI+Gc0yhMfvdLAV7TzhPtbybPWFk00tjZmOP6qFbAdAzSuC2Wj3VVump+cOh\nhXY4JHGLCU5ziXG7Z3/70e6LGBpA9AIpy7uCtRUb/eslxPbj/9dXuvDx8HPl\nLQSQd1jjuaxIpL0bjBUht8hTU9pmwVZUcPKWp0DOzDtgGZtGqVWjDKZZsq85\nueZ3EpxnA314xCaTvGFpWhq1IR8fcR+bKe7gIRGM89o9OI77EHu1YTKrDB7E\nhRUo8QRfUsXeGtbivlrTVNVYnA3jwt9zxeO6p/AO4Fq8ptPJJKmUXba2moSp\nkP5VlG8mxrdaJ0OmlHYEK3IMsnrw3iDAMJYt/WHHd+e3rU9NbYnwtCLfgb36\nXmYGbfQGGkVxTnk5tDGnTFA73WVckSSvr/+PLmxFLzXyUNDwGs6ediBl6xgi\nXoBuuwaix9p/PxE5tkxp0woWVOlqxa0Lys6ieQEQwq2WcY29B8WeApPj2tPB\nD3d98Oe0rB1uHy+X/rTTyeN5akGqbwfLT00khvnSiM0BcEE6Q6IVFxcDFqLQ\nEC19\r\n=g7ZM\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDaxwdUXB1El8c1TnOimccg4cbM4H+zXCruv4TRzOK29AIhAMsUsrOWTGIIsA7lm2kw4jfd8nY0lxHheLQeHSCr94S8"}],"size":2770,"noattachment":false,"key":"/@nbsh/to-type/-/@nbsh/to-type-5.0.0-next.1.tgz"},"maintainers":[{"name":"rannn505","email":"rannn505@outlook.com"}],"_npmUser":{"name":"rannn505","email":"rannn505@outlook.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/to-type_5.0.0-next.1_1589242985561_0.8190950344732222"},"_hasShrinkwrap":false,"publish_time":1589242985709,"_cnpm_publish_time":1589242985709}},"readme":"# `to-type`\n\n> Fixes JavaScript typeof operator using Symbol.toStringTag\n\n## Installation\n\n```bash\n$ npm i -S @nbsh/to-type\n$ yarn add @nbsh/to-type\n```\n\n## Usage\n\n```js\nimport { strictEqual } from 'assert';\nimport { toType, Types } from '@nbsh/to-type';\n\ntoType(4); // \"number\"\ntoType('abc'); // \"string\"\ntoType(true); // \"boolean\"\ntoType({ a: 4 }); // \"object\"\ntoType([1, 2, 3]); // \"array\"\ntoType(new Date()); // \"date\"\ntoType(/a-z/); // \"regexp\"\ntoType(undefined); // \"undefined\"\ntoType(null); // \"null\"\ntoType(new TypeError()); // \"error\"\ntoType(() => {}); // \"function\"\n\nstrictEqual(toType(4), Types.Number); // true\nstrictEqual(toType('abc'), Types.String); // true\n```\n\n## API\n\n### `toType(object: unknown): string`\n\nThe `toType()` method return the default string description of the object it receive as argument. `toType()` do not affect the object itself.\nSee [Symbol.toStringTag](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toStringTag).\n\n### `Types: enum`\n\nThe `Types` enum represent the [well-known](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures) string descriptions that `toType()` method return. **Note**, implementing a class that overrides the toStringTab symbol will not make its value available within this enum.\n","_attachments":{},"homepage":"http://rannn505.github.io/node-powershell/tree/master/toType#readme","bugs":{"url":"https://github.com/rannn505/node-powershell/issues"},"license":"MIT"}