{"_id":"@sniptt/guards","_rev":"6-4184e12f08920746a6f76c22f5298094","name":"@sniptt/guards","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.1":{"name":"@sniptt/guards","version":"0.1.1","keywords":["monads","option","result","either","javascript","js","typescript","node","node.js"],"author":{"url":"sniptt.com","name":"Sniptt","email":"support@sniptt.com"},"license":"MIT","_id":"@sniptt/guards@0.1.1","maintainers":[{"name":"snipttbot","email":"support+npm@sniptt.com"}],"homepage":"https://github.com/sniptt-official/guards","bugs":{"url":"https://github.com/sniptt-official/guards/issues"},"ava":{"require":["ts-node/register"],"verbose":true,"extensions":["ts"]},"dist":{"shasum":"6c309b81d2050001d567b244afb72079efa39ea9","tarball":"https://registry.npmjs.org/@sniptt/guards/-/guards-0.1.1.tgz","fileCount":3,"integrity":"sha512-TOVVN/4yJd8gKP7sB4v+4LHawvky3q2fseiQ0YK4TWjmvVQNeQeB1ZQiVe7VvlWxVs5HfZB9hTFdTlZYmBv7Zg==","signatures":[{"sig":"MEUCIQDeSJdTuG6rXbkTF90+ef3TptNPuD5HXq7eRGFtdFwy8AIgBipP/oOIIqROVw6KlRdj/SAb8quwXCCqxLvHNVToM2E=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11681,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg/IkdCRA9TVsSAnZWagAA1yoP/RsVqpVNLkcOlbZS5rph\nAP65gtQ9Pw20cDMlDUlwg+V+U02VSwZdBv6fAn9W4cLvJewdqNrh9ETjsDi4\nREX11rzUF3HAvYHQk1IzXaXOE6JzvQ5DTEIxg4dtd0twk7JaBsvVA8GfsbLD\nkqGH6Be2IIR6OjM9xNQ9wmqZpbjkKRxs9JFjhGyrFg65/1KNp1fNfc4Jc0AX\noQdrJdkloTlkoHd0gZwFAo4fwcByvsfAtiIvoCnWo4HeMR/nFPznW70B9F/k\nEEEE1YYYsiPGwwyvUPLazTtEGSgexvaOYmndK58lRuVzffmUPuo8gIro1Nxa\nuRBJImbsJYVV+2f7gbgbt//DhxMMhURP1U9bJa0GnYa7iXR7xRewAngUkLBJ\nMUh5BheJXsKLBDOjoaRa3yLl1/xQgLnHcMSx3DxgSem8S0DOlOGVlvm72wT8\nCdsyc+N547MSrHNUwd5yte8tmanm7eX6hpb+dwxcm6MiXEnR01Xih20Ttuf5\ndwtnzeyqQFUBvPCIm1yIiX/ndK28IN1xkGb07dwLAlurpy3NpVXsQLdpdhtW\nPv0qvQkan2w4IdIBbvtAFKpQgFY/jhnG4r/gt90+XYI2nZKczVFPLYfiMbTR\npQhArnfxPiqxUJYeymwWrFMADmBsioZ2iLWR2D5bsGB0eTYmcdJf918QHGh4\nljs7\r\n=uDQF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"build/index.js","types":"build","engines":{"npm":">=7","node":">=14"},"gitHead":"812003908d9574da995d02ef1f9dac800a00a089","scripts":{"docs":"rm -rf ./docs && typedoc lib/index.ts --excludePrivate --excludeProtected --plugin typedoc-plugin-markdown --readme none --out ./docs","test":"nyc ava --fail-fast ./test/**/*.test.ts","build":"rm -rf build deno && tsc && denoify && mv deno_build deno && npm run format","format":"prettier --loglevel warn --write \"**/*.{ts,js,json,yaml}\"","preversion":"npm run format:check && npm run build && npm test","postversion":"git push --follow-tags","format:check":"prettier --loglevel warn --check \"**/*.{ts,js,json,yaml}\""},"_npmUser":{"name":"snipttbot","email":"support+npm@sniptt.com"},"_npmVersion":"6.14.13","description":"Comprehensive collection of type guards for JavaScript and TypeScript; Inspired by Elixir","directories":{},"_nodeVersion":"14.17.3","_hasShrinkwrap":false,"devDependencies":{"ava":"3.15.0","nyc":"15.1.0","denoify":"0.7.2","ts-node":"10.1.0","typedoc":"0.21.4","prettier":"2.3.2","typescript":"4.3.5","typedoc-plugin-markdown":"3.10.4"},"_npmOperationalInternal":{"tmp":"tmp/guards_0.1.1_1627162909449_0.03177544553834766","host":"s3://npm-registry-packages"}},"0.1.2":{"name":"@sniptt/guards","version":"0.1.2","keywords":["guards","javascript","js","typescript","node","node.js"],"author":{"url":"sniptt.com","name":"Sniptt","email":"support@sniptt.com"},"license":"MIT","_id":"@sniptt/guards@0.1.2","maintainers":[{"name":"snipttbot","email":"support+npm@sniptt.com"}],"homepage":"https://github.com/sniptt-official/guards","bugs":{"url":"https://github.com/sniptt-official/guards/issues"},"ava":{"require":["ts-node/register"],"verbose":true,"extensions":["ts"]},"dist":{"shasum":"59a89f71ebe82335d9e1339eaf3bec8f5ab2e114","tarball":"https://registry.npmjs.org/@sniptt/guards/-/guards-0.1.2.tgz","fileCount":3,"integrity":"sha512-gkMY70tkR80rxBCl/wk+2NnK3olSo34SZ70nkYnrLuTHnSo359Ok8jW2Q/Z8Od759nlKlugDGLrHXUP1n5Z++Q==","signatures":[{"sig":"MEQCICZDwBj9a2wzvzo1Y8srP0/iPm3o//Qmfmh+iMGJJghYAiBCuNSgOqPDAHWNbo4yL2JcjYoe3Lmk2IdeOnuMlEMb6g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11639,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg/IpCCRA9TVsSAnZWagAAhcEQAKRAaVGd8gzlGJ0ymzYL\nXBWJz7oscdXh9i61MrtSrBLsg1zRap04qMZY0ohAjfKLryOABlLd5YBekgLe\nn1ZRa59NEC83ulbRXkVPP7J+cJTw1f1euVTc+JTb7sXY39PCsteR3hKKupwC\nEipdeGXbYYJAjpfQp5Hia1PWvxpwzHsVcm+v4PAjfVGN1ML2l4iSSvMOm+bi\nvQQhLWBaJMOCuv7GYZHm/rdED72mzaglFJhWNTELXpTPlvJC/1IzXyR1cc4f\ntUZnl831mzStlXhtbrEe7iOQ6pD4y8xmWVGcAByJ/Ep/Gn5QD4GhH14cNJC2\ngx32Om23JOUT3ORivfv4a9mss84d2jg6v1HYIUUc6OighbazEb0JDgoHPdA2\nxFbAIHMtlvN0y1gLqWX44Rn4xSsk31PvQKY0B9WxUjgrtoKPQN27RDusSmRk\n+MTsK5pewVk+tC7oXruM2ApcSjdz3OY/MJtjY8LzvqhJAwQDQT0XK6PrK6w+\n0zkfL+MNRim5y/HClNabo9Kr9HARsQPGD4+q5mteGTamYW2lAILeTvVBBE+H\n7ZVoi0BM1LzRuWTDIVfZaXXFSmOj3PLtBEgy/FEFpmjp5aBHi7N2Bg6eI9Np\n4nt9uBnRRH0eniLZVTcJ0w1mD//JSIPuAHMOEDcCk2CBTaC+Cr1Dg0ZRdPkF\nC8FY\r\n=8h89\r\n-----END PGP SIGNATURE-----\r\n"},"main":"build/index.js","types":"build","engines":{"npm":">=7","node":">=14"},"gitHead":"08668f5a6478155a5f7e332749e2b5bacc2d850c","scripts":{"docs":"rm -rf ./docs && typedoc lib/index.ts --excludePrivate --excludeProtected --plugin typedoc-plugin-markdown --readme none --out ./docs","test":"nyc ava --fail-fast ./test/**/*.test.ts","build":"rm -rf build deno && tsc && denoify && mv deno_build deno && npm run format","format":"prettier --loglevel warn --write \"**/*.{ts,js,json,yaml}\"","preversion":"npm run format:check && npm run build && npm test","postversion":"git push --follow-tags","format:check":"prettier --loglevel warn --check \"**/*.{ts,js,json,yaml}\""},"_npmUser":{"name":"snipttbot","email":"support+npm@sniptt.com"},"_npmVersion":"6.14.13","description":"Comprehensive collection of type guards for JavaScript and TypeScript; Inspired by Elixir","directories":{},"_nodeVersion":"14.17.3","_hasShrinkwrap":false,"devDependencies":{"ava":"3.15.0","nyc":"15.1.0","denoify":"0.7.2","ts-node":"10.1.0","typedoc":"0.21.4","prettier":"2.3.2","typescript":"4.3.5","typedoc-plugin-markdown":"3.10.4"},"_npmOperationalInternal":{"tmp":"tmp/guards_0.1.2_1627163202812_0.5084681700561293","host":"s3://npm-registry-packages"}},"0.1.3":{"name":"@sniptt/guards","version":"0.1.3","keywords":["guards","javascript","js","typescript","node","node.js"],"author":{"url":"sniptt.com","name":"Sniptt","email":"support@sniptt.com"},"license":"MIT","_id":"@sniptt/guards@0.1.3","maintainers":[{"name":"snipttbot","email":"support+npm@sniptt.com"}],"homepage":"https://github.com/sniptt-official/guards","bugs":{"url":"https://github.com/sniptt-official/guards/issues"},"ava":{"require":["ts-node/register"],"verbose":true,"extensions":["ts"]},"dist":{"shasum":"3a21467392592d34a2b7ce316b142a79322c2a94","tarball":"https://registry.npmjs.org/@sniptt/guards/-/guards-0.1.3.tgz","fileCount":19,"integrity":"sha512-XSOfGs6rhRcm4LQHOzzsvubPN+jrIHxCSfjH/xyobTTxeScyBMX0BOmzsyp7aiwFq0xuaZB7L7M7YIqHc4YrpA==","signatures":[{"sig":"MEQCIByNoar9QhvqbAjJKB4V+Q9ZxHwcWJpgKL9g09O0IU/rAiBbIFWr2/fg/1W11Unh+/kV50u98/VAP/DwAqI8TsjLrw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":23460,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg/Is4CRA9TVsSAnZWagAA4QQP/05Ov6lcRVGnMARm9fi6\ne23A/ER59f5Ux1yMo92oHIyBFqz9GdeSI0nxqik1U5dI2bW2gb/4Uk1UDwFd\nnRdYpyugzAP65hLIinlQBeQIYbfHeGF2fWvNCe/h3dMDytcpzx9ncvzODhp+\nyLyA44BH2wCPJUbsQWvzIHW26oYweqDrEaEMVtHyVILszyEFaV/YE3zKZ3yc\ndML2Fsd34JChvCDqVtc2SxbgtyLzIniZVAKH/0POudqY26GA/OEfMCel6dMs\nOHpNBM+wOM094f+pIZzV2i2BZzuqN1o5jqwmq/TD1GAh+KMcWLgRrzASQjP2\nne6BkJXcDZOZY1bVM8LzuQl8Zing8xPQRkmhdm0B6xbMur21s6Fc6PQ/T+Sh\nO2Y5Kj/PQdKJibHoP8opFw+uJGxK15LoCKfGJaVP58x7YFJj0WvKzz04abvu\nc9PpDU8YQEChjTW6WNgm/6hITuNTI2OB2LjwFDqN/HPusd427rAN92ZkkX+u\nTRIp6VrkSzYUFeIUsn5Jdsn3sLcwvjlcFGhaFasb8iQuSdim/NRpwevUZrM2\nAdiUa+BBAxosUhc2D64zYOg7pOhlh7TLNLraV7KMPJRN5p+tf3PasoJGxH0A\nZw3LshbmnmGhfkxL5VMkLOJSSntkogX546k9JaIvMQl6qbmHUsmyiWIpURr1\njX9m\r\n=oIrK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"build/index.js","types":"build","engines":{"npm":">=7","node":">=14"},"gitHead":"799f812fd06b681152130059d971d5e4a127816e","scripts":{"docs":"rm -rf ./docs && typedoc lib/index.ts --excludePrivate --excludeProtected --plugin typedoc-plugin-markdown --readme none --out ./docs","test":"nyc ava --fail-fast ./test/**/*.test.ts","build":"rm -rf build deno && tsc && denoify && mv deno_build deno && npm run format","format":"prettier --loglevel warn --write \"**/*.{ts,js,json,yaml}\"","preversion":"npm run format:check && npm run build && npm test","postversion":"git push --follow-tags","format:check":"prettier --loglevel warn --check \"**/*.{ts,js,json,yaml}\""},"_npmUser":{"name":"snipttbot","email":"support+npm@sniptt.com"},"_npmVersion":"6.14.13","description":"Comprehensive collection of type guards for JavaScript and TypeScript; Inspired by Elixir","directories":{},"_nodeVersion":"14.17.3","_hasShrinkwrap":false,"devDependencies":{"ava":"3.15.0","nyc":"15.1.0","denoify":"0.7.2","ts-node":"10.1.0","typedoc":"0.21.4","prettier":"2.3.2","typescript":"4.3.5","typedoc-plugin-markdown":"3.10.4"},"_npmOperationalInternal":{"tmp":"tmp/guards_0.1.3_1627163448149_0.6019264767905947","host":"s3://npm-registry-packages"}},"0.1.4":{"name":"@sniptt/guards","version":"0.1.4","keywords":["guards","javascript","js","typescript","node","node.js"],"author":{"url":"sniptt.com","name":"Sniptt","email":"support@sniptt.com"},"license":"MIT","_id":"@sniptt/guards@0.1.4","maintainers":[{"name":"snipttbot","email":"support+npm@sniptt.com"}],"homepage":"https://github.com/sniptt-official/guards","bugs":{"url":"https://github.com/sniptt-official/guards/issues"},"ava":{"require":["ts-node/register"],"verbose":true,"extensions":["ts"]},"dist":{"shasum":"2a9a6389b2de5bbd020087438e93cc7b96461438","tarball":"https://registry.npmjs.org/@sniptt/guards/-/guards-0.1.4.tgz","fileCount":19,"integrity":"sha512-j5Xcj5x2oP0jMUDa57cNtSad2xjFqaNOKVQDTcMhUIgnmeyp0t+56PFiU6rwkhmb2Gobc29E2k/eZdrJk/HdIA==","signatures":[{"sig":"MEUCIHieg1a7qroDxD6sHgzp/3yDcRrxVTQrGOHDZdVPvALsAiEA7RCvlXNxc8yguQ/fwEupGfI70cWMezlvhOCdRMROD8Q=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":23921,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg/I4SCRA9TVsSAnZWagAAOTYP+wQL2tyV8wrJE/euPQVl\nHS9VBBsogZf+V08fB6tSBrTONSfNPOBOnyoKXqIgfrZimeq0bo2OFPbPN1zU\n2xJeKrglhJz7KoiygnviEdV7d3pH5SNT7Zyd9MhT8gmegC6XW+sBDh+ZqRdz\nX6fSVkz5FgFvEZHi3ZmOtJwCcmozxUi3bn99qJINhplFOtiihFsQJ2zbjwU7\naC2j8zNVPdf8AztlXW7aElWEYTNqbstNV+VmuE1ZSG42oeeNrvYiZwoc4yy+\nqrk0j4gNEXc5N1j633N0okLE9/Fxuh3QRALo9UJp0dsO4fB/CZM7bBwt2w85\nfJFDevki22HDCybX3mrT2yD1tkvbl3YAMKIdNK/AYXbAmTcm9S167y9xiUiI\nt24luY1tj5CJ9QYvx6WifGpFD2RLjCB5g5U2sXXZI/Fv7A23crh7NDGjA8v+\nHlic/ABuQFgvAtCmpyKCH+Xf55ylm+IP7Y/Yg9/Dep/CGxiA36LCDH7n+FF3\n5yng9EBRS4tQo40RPRQ5PeBChLJbDlKsBrqAtI1TGn8Fjy11jZsAuJw9MbHJ\nZ78ozUWKtKJ8DazVAlHwcu7zjwUvJzmLtefaOov/Yo/mZH08WX2tBU502fho\nXbiVZJuQogUDKdMvSjarq1pybUthrhbLldcIjQrbBVAWBbYxtlEK6KLXNkTg\na+dO\r\n=frLw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"build/index.js","types":"build","engines":{"npm":">=7","node":">=14"},"gitHead":"afc9150306a1cd9e3abeb396685cda60592a86a5","scripts":{"docs":"rm -rf ./docs && typedoc lib/index.ts --excludePrivate --excludeProtected --plugin typedoc-plugin-markdown --readme none --out ./docs","test":"nyc ava --fail-fast ./test/**/*.test.ts","build":"rm -rf build deno && tsc && denoify && mv deno_build deno && npm run format","format":"prettier --loglevel warn --write \"**/*.{ts,js,json,yaml}\"","preversion":"npm run format:check && npm run build && npm test","postversion":"git push --follow-tags","format:check":"prettier --loglevel warn --check \"**/*.{ts,js,json,yaml}\""},"_npmUser":{"name":"snipttbot","email":"support+npm@sniptt.com"},"_npmVersion":"6.14.13","description":"Comprehensive collection of type guards for JavaScript and TypeScript; Inspired by Elixir","directories":{},"_nodeVersion":"14.17.3","_hasShrinkwrap":false,"devDependencies":{"ava":"3.15.0","nyc":"15.1.0","denoify":"0.7.2","ts-node":"10.1.0","typedoc":"0.21.4","prettier":"2.3.2","typescript":"4.3.5","typedoc-plugin-markdown":"3.10.4"},"_npmOperationalInternal":{"tmp":"tmp/guards_0.1.4_1627164178408_0.9683626723689251","host":"s3://npm-registry-packages"}},"0.2.0":{"name":"@sniptt/guards","version":"0.2.0","keywords":["guards","javascript","js","typescript","node","node.js"],"author":{"url":"sniptt.com","name":"Sniptt","email":"support@sniptt.com"},"license":"MIT","_id":"@sniptt/guards@0.2.0","maintainers":[{"name":"snipttbot","email":"support+npm@sniptt.com"}],"homepage":"https://github.com/sniptt-official/guards","bugs":{"url":"https://github.com/sniptt-official/guards/issues"},"ava":{"require":["ts-node/register"],"verbose":true,"extensions":["ts"]},"dist":{"shasum":"6b95d259bfd77c5db2945605e033cdcfcea97eba","tarball":"https://registry.npmjs.org/@sniptt/guards/-/guards-0.2.0.tgz","fileCount":19,"integrity":"sha512-QNxknl5YcrxpLtP99iEvNEJRlfXtIfpkvcEWHJKD6bHUr93dsH6OZGUF6reVBddKs1ps44lndSMoDK2Dz0n6ZQ==","signatures":[{"sig":"MEUCIEh6l2gZPMafP8CvZaWh8GK8WuCT6Yv1c7bwPXaWFpGJAiEAjIRwql/bG77gH6darN6aL41TjBX6Qjlq+Wo8vbhToAw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":23922,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg/psWCRA9TVsSAnZWagAAX90P/3nivaYOIeadhO6Hg19n\n7aCjcmnnQJ4r+gG2Hr/HhNymBYGR28Ew3pJsw+btPa75uz95DBEfNasPwS3U\nrtC57pn7bYmUOIqh4wQeeUEiq8xL1Ht9rAOBSGgnOR+GkC4sxaxLQSYgnUHV\nyN44IF7xG+X9OdTxw35AGxPG5ILWDq/UgotiC2C+seQJ0zgeAZB5GY1SHh05\nQg1tkp29GW0Ks1yn30H12HZrBaATRXBiJP4Q8GxsRzRXF5VWwAZsVnict7zC\nz0iE06y/gtAxx1ebIIhGaK2TmqS++ocnAVHLBwp4FA0ngjoBhD3xGbAmAZbY\nB19iMt+4p6Ftn17bbE9coz8XRBoIf7j1ii//jdrtYQWg7VTeqiIfFDX1YmL6\nsH1px3KqsKQfP0IApigLiOaq18GZgNrXmxTFeX+oV3AC1NdDNsYHrf/1NPOu\nskicT5bMzn9wtOA8ep/gRRAa2PX4gfpg/K+cRAq1Ztm4N1/HqrXvVL7uQ1Jy\nPlFcRhT3yp9KGCuFldnbIKDQ/i7ObbKMqgKvHIU298xOtwnoSnDaoYGZYLXy\n3fEPe9feUB5aHmruh4dcV77vDzk2BFXr+eyTCV9D3oyZFco/ST2u9D3JXfTp\nodwupgDCnLH8C8JfViHxyNaTBLmDPUQ3IV7zwHdZRJCTrpuh5/ebqhX70QkJ\nGyj3\r\n=U5TS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"build/index.js","types":"build","engines":{"npm":">=7","node":">=14"},"gitHead":"76ff862ed0eb2d3bcc622552e255426cf274a67b","scripts":{"docs":"rm -rf ./docs && typedoc lib/index.ts --excludePrivate --excludeProtected --plugin typedoc-plugin-markdown --readme none --out ./docs","test":"nyc ava --fail-fast ./test/**/*.test.ts","build":"rm -rf build deno && tsc && denoify && mv deno_build deno && npm run format","format":"prettier --loglevel warn --write \"**/*.{ts,js,json,yaml}\"","preversion":"npm run format:check && npm run build && npm test","postversion":"git push --follow-tags","format:check":"prettier --loglevel warn --check \"**/*.{ts,js,json,yaml}\""},"_npmUser":{"name":"snipttbot","email":"support+npm@sniptt.com"},"_npmVersion":"6.14.13","description":"Comprehensive collection of type guards for JavaScript and TypeScript; Inspired by Elixir","directories":{},"_nodeVersion":"14.17.3","_hasShrinkwrap":false,"devDependencies":{"ava":"3.15.0","nyc":"15.1.0","denoify":"0.7.2","ts-node":"10.1.0","typedoc":"0.21.4","prettier":"2.3.2","typescript":"4.3.5","typedoc-plugin-markdown":"3.10.4"},"_npmOperationalInternal":{"tmp":"tmp/guards_0.2.0_1627298582617_0.8359926937931323","host":"s3://npm-registry-packages"}}},"time":{"created":"2021-07-24T21:41:49.402Z","modified":"2025-02-09T18:35:04.216Z","0.1.1":"2021-07-24T21:41:49.588Z","0.1.2":"2021-07-24T21:46:42.936Z","0.1.3":"2021-07-24T21:50:48.290Z","0.1.4":"2021-07-24T22:02:58.539Z","0.2.0":"2021-07-26T11:23:02.779Z"},"bugs":{"url":"https://github.com/sniptt-official/guards/issues"},"author":{"url":"sniptt.com","name":"Sniptt","email":"support@sniptt.com"},"license":"MIT","homepage":"https://github.com/sniptt-official/guards","keywords":["guards","javascript","js","typescript","node","node.js"],"description":"Comprehensive collection of type guards for JavaScript and TypeScript; Inspired by Elixir","maintainers":[{"email":"support@npmjs.com","name":"npm-support"}],"readme":"<p align=\"center\">\n  <a href=\"https://sniptt.com\">\n    <img src=\".github/assets/guards-social-cover.svg\" alt=\"Guards Logo\" />\n  </a>\n</p>\n\n<p align=\"right\">\n  <i>If you use this repo, star it ✨</i>\n</p>\n\n***\n\n<p align=\"center\">👻 <b>Comprehensive collection of type guards for JavaScript and TypeScript</b></p>\n\n<p align=\"center\">\n  Inspired by <a href=\"https://hexdocs.pm/elixir/guards.html\" target=\"_blank\">Elixir guards</a>\n</p>\n\n<p align=\"center\">\n  <b>Zero dependencies</b> 💪\n</p>\n\n***\n\n## Install\n\n### Node.js and the browser\n\n```sh\nnpm install @sniptt/guards\n```\n\n### Deno\n\n```typescript\nimport { ... } from 'https://deno.land/x/guards/mod.ts'\n\n// TODO\n```\n\n## Usage\n\n### Foreword on JavaScript data types and data structures\n\nThe latest ECMAScript standard defines nine types:\n\n*   Six **Data Types** that are primitives, checked by `typeof` operator:\n    *   `undefined`: `typeof instance === \"undefined\"`\n    *   `Boolean`: `typeof instance === \"boolean\"`\n    *   `Number`: `typeof instance === \"number\"`\n    *   `String`: `typeof instance === \"string\"`\n    *   `BigInt`: `typeof instance === \"bigint\"`\n    *   `Symbol`: `typeof instance === \"symbol\"`\n*   **Structural Types**:\n    *   `Object`: `typeof instance === \"object\"`. Special non-data but structural type for any constructed object instance also used as data structures: new `Object`, new `Array`, new `Map`, new `Set`, new `WeakMap`, new `WeakSet`, new `Date` and almost everything made with `new` keyword;\n    *   `Function` non data structure, though it also answers for `typeof` operator: `typeof instance === \"function\"`. This answer is done as a special shorthand for `Function`s, though every `Function` constructor is derived from `Object` constructor.\n*   **Structural Root** Primitive\n    *   `null`: `typeof instance === \"object\"`. Special primitive type having additional usage for it's value: if object is not inherited, then `null` is shown;\n\nSource: <https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures>\n\n### Type coercion\n\n![Type coercion example](.github/assets/type-coercion.png)\n\n### Primitives\n\nSample usage:\n\n```typescript\nimport { primitives } from '@sniptt/guards';\n\nprimitives.isNumber(val);\n```\n\nor\n\n```typescript\nimport { isNumber } from '@sniptt/guards';\n\nisNumber(val);\n```\n\n#### `isBigInt`\n\n```typescript\nimport { isBigInt } from '@sniptt/guards';\n\nlet val: bigint | number;\n\nif (isBigInt(val)) {\n  // TypeScript will infer val: bigint\n} else {\n  // TypeScript will infer val: number\n}\n```\n\n#### `isBoolean`\n\n```typescript\nimport { isBoolean } from '@sniptt/guards';\n\nlet val: boolean | number;\n\nif (isBoolean(val)) {\n  // TypeScript will infer val: boolean\n} else {\n  // TypeScript will infer val: number\n}\n```\n\n#### `isNumber`\n\nAnswers `false` to `NaN`!\n\nSee also:\n\n*   [isNumberOrNaN](#isnumberornan)\n*   [isInteger](#isinteger)\n*   [isBigInt](#isbigint)\n\n```typescript\nimport { isNumber } from '@sniptt/guards';\n\nlet val: number | string;\n\nif (isNumber(val)) {\n  // TypeScript will infer val: number\n} else {\n  // TypeScript will infer val: string\n}\n```\n\n#### `isString`\n\n```typescript\nimport { isString } from '@sniptt/guards';\n\nlet val: string | number;\n\nif (isString(val)) {\n  // TypeScript will infer val: string\n} else {\n  // TypeScript will infer val: number\n}\n```\n\n#### `isSymbol`\n\n```typescript\nimport { isSymbol } from '@sniptt/guards';\n\nlet val: symbol | string;\n\nif (isSymbol(val)) {\n  // TypeScript will infer val: symbol\n} else {\n  // TypeScript will infer val: string\n}\n```\n\n#### `isUndefined`\n\n```typescript\nimport { isUndefined } from '@sniptt/guards';\n\nlet val: undefined | null;\n\nif (isUndefined(val)) {\n  // TypeScript will infer val: undefined\n} else {\n  // TypeScript will infer val: null\n}\n```\n\n### Structural\n\nSample usage:\n\n```typescript\nimport { structural } from '@sniptt/guards';\n\nstructural.isMap(val);\n```\n\nor\n\n```typescript\nimport { isMap } from '@sniptt/guards';\n\nisMap(val);\n```\n\n#### `isNull`\n\nAnswers `true` if and only if `value === null`.\n\n#### `isFunction`\n\nAnswers `true` if and only if `typeof value === \"function\"`.\n\n#### `isObject`\n\nAnswers `false` to `null`!\n\nTo check for array:\n\n```typescript\nisArray(term)\n```\n\nTo check for object *or* null:\n\n```typescript\nisObjectOrNull(term)\n```\n\n#### `isArray`\n\nAnswers `true` if and only if `Array.isArray(value) === true`.\n\n#### `isMap`\n\nAnswers `true` if and only if `(value instanceof Map) === true`.\n\n#### `isSet`\n\nAnswers `true` if and only if `(value instanceof Set) === true`.\n\n#### `isWeakMap`\n\nAnswers `true` if and only if `(value instanceof WeakMap) === true`.\n\n#### `isWeakSet`\n\nAnswers `true` if and only if `(value instanceof WeakSet) === true`.\n\n#### `isDate`\n\nAnswers `true` if and only if `(value instanceof Date) === true`.\n\n### Convenience\n\nSample usage:\n\n```typescript\nimport { convenience } from '@sniptt/guards';\n\nconvenience.isNonEmptyArray(val);\n```\n\nor\n\n```typescript\nimport { isNonEmptyArray } from '@sniptt/guards';\n\nisNonEmptyArray(val);\n```\n\n#### `isObjectOrNull`\n\n```typescript\ntest(\"isObjectOrNull\", (t) => {\n  t.is(convenience.isObjectOrNull({}), true);\n  t.is(convenience.isObjectOrNull(null), true);\n  t.is(convenience.isObjectOrNull(new Set()), true);\n});\n```\n\n#### `isNonEmptyArray`\n\n```typescript\ntest(\"isNonEmptyArray\", (t) => {\n  t.is(convenience.isNonEmptyArray([1, 2]), true);\n  t.is(convenience.isNonEmptyArray([1]), true);\n  t.is(convenience.isNonEmptyArray([]), false);\n});\n```\n\n#### `isNonEmptyString`\n\n```typescript\ntest(\"isNonEmptyString\", (t) => {\n  t.is(convenience.isNonEmptyString(\"a\"), true);\n  t.is(convenience.isNonEmptyString(\"\"), false);\n});\n```\n\n#### `isNumberOrNaN`\n\n```typescript\ntest(\"isNumberOrNaN\", (t) => {\n  t.is(convenience.isNumberOrNaN(0), true);\n  t.is(convenience.isNumberOrNaN(42), true);\n  t.is(convenience.isNumberOrNaN(-42), true);\n  t.is(convenience.isNumberOrNaN(3.14), true);\n  t.is(convenience.isNumberOrNaN(-3.14), true);\n  t.is(convenience.isNumberOrNaN(Infinity), true);\n  t.is(convenience.isNumberOrNaN(-Infinity), true);\n  t.is(convenience.isNumberOrNaN(Number.MAX_SAFE_INTEGER), true);\n  t.is(convenience.isNumberOrNaN(-Number.MAX_SAFE_INTEGER), true);\n  t.is(convenience.isNumberOrNaN(NaN), true);\n  t.is(convenience.isNumberOrNaN(BigInt(0)), false);\n});\n```\n\n#### `isInteger`\n\n```typescript\ntest(\"isInteger\", (t) => {\n  t.is(convenience.isInteger(0), true);\n  t.is(convenience.isInteger(42), true);\n  t.is(convenience.isInteger(-42), true);\n  t.is(convenience.isInteger(3.14), false);\n  t.is(convenience.isInteger(-3.14), false);\n  t.is(convenience.isInteger(Infinity), false);\n  t.is(convenience.isInteger(-Infinity), false);\n  t.is(convenience.isInteger(Number.MAX_SAFE_INTEGER), true);\n  t.is(convenience.isInteger(-Number.MAX_SAFE_INTEGER), true);\n  t.is(convenience.isInteger(NaN), false);\n});\n```\n\n#### `isPositiveInteger`\n\n```typescript\ntest(\"isPositiveInteger\", (t) => {\n  t.is(convenience.isPositiveInteger(0), false);\n  t.is(convenience.isPositiveInteger(42), true);\n  t.is(convenience.isPositiveInteger(-42), false);\n  t.is(convenience.isPositiveInteger(3.14), false);\n  t.is(convenience.isPositiveInteger(-3.14), false);\n  t.is(convenience.isPositiveInteger(Infinity), false);\n  t.is(convenience.isPositiveInteger(-Infinity), false);\n  t.is(convenience.isPositiveInteger(Number.MAX_SAFE_INTEGER), true);\n  t.is(convenience.isPositiveInteger(-Number.MAX_SAFE_INTEGER), false);\n  t.is(convenience.isPositiveInteger(NaN), false);\n});\n```\n\n#### `isNonNegativeInteger`\n\n```typescript\ntest(\"isNonNegativeInteger\", (t) => {\n  t.is(convenience.isNonNegativeInteger(0), true);\n  t.is(convenience.isNonNegativeInteger(42), true);\n  t.is(convenience.isNonNegativeInteger(-42), false);\n  t.is(convenience.isNonNegativeInteger(3.14), false);\n  t.is(convenience.isNonNegativeInteger(-3.14), false);\n  t.is(convenience.isNonNegativeInteger(Infinity), false);\n  t.is(convenience.isNonNegativeInteger(-Infinity), false);\n  t.is(convenience.isNonNegativeInteger(Number.MAX_SAFE_INTEGER), true);\n  t.is(convenience.isNonNegativeInteger(-Number.MAX_SAFE_INTEGER), false);\n  t.is(convenience.isNonNegativeInteger(NaN), false);\n});\n```\n\n#### `isNegativeInteger`\n\n```typescript\ntest(\"isNegativeInteger\", (t) => {\n  t.is(convenience.isNegativeInteger(0), false);\n  t.is(convenience.isNegativeInteger(42), false);\n  t.is(convenience.isNegativeInteger(-42), true);\n  t.is(convenience.isNegativeInteger(3.14), false);\n  t.is(convenience.isNegativeInteger(-3.14), false);\n  t.is(convenience.isNegativeInteger(Infinity), false);\n  t.is(convenience.isNegativeInteger(-Infinity), false);\n  t.is(convenience.isNegativeInteger(Number.MAX_SAFE_INTEGER), false);\n  t.is(convenience.isNegativeInteger(-Number.MAX_SAFE_INTEGER), true);\n  t.is(convenience.isNegativeInteger(NaN), false);\n});\n```\n\n## API Docs\n\n[Full API Documentation](docs/README.md).\n\n## License\n\nSee [LICENSE](LICENSE)\n","readmeFilename":"README.md"}