{"_id":"@aarondill/is-tagged","name":"@aarondill/is-tagged","dist-tags":{"latest":"2.1.2"},"versions":{"2.1.2":{"name":"@aarondill/is-tagged","version":"2.1.2","description":"Detect if a function is called as a tagged template or a regular function call","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"prepublishOnly":"npm test && npm run build","test":"jest","build":"tsc --build","clean":"rimraf ./dist","prebuild":"npm run clean","prewatch":"npm run clean","watch":"rimraf ./dist/* && tsc --watch"},"repository":{"type":"git","url":"git+https://github.com/aarondill/isTagged.git"},"author":{"name":"Aaron Dill"},"license":"ISC","bugs":{"url":"https://github.com/aarondill/isTagged/issues"},"homepage":"https://github.com/aarondill/isTagged#readme","devDependencies":{"@types/jest":"^29.2.4","jest":"^29.3.1","rimraf":"^3.0.2","ts-jest":"^29.0.3","ts-node":"^10.9.1","typescript":"^4.9.4"},"publishConfig":{"access":"public"},"dependencies":{"@types/node":"^18.13.0"},"gitHead":"ae8a18fa22444c9d13a459ba8112137021a570ca","_id":"@aarondill/is-tagged@2.1.2","_nodeVersion":"18.14.0","_npmVersion":"9.4.2","dist":{"integrity":"sha512-xU1BZy+fjlyCawuv2fIm8sA+YhgNyi4/EL4XIC1QhZTdWI5hyYYZbyZIpcJZ3c0hv5KbgXlPzDEaXJVFZzYouA==","shasum":"b76397243492ac058ee2a300baedaa2c5ae16201","tarball":"https://registry.npmjs.org/@aarondill/is-tagged/-/is-tagged-2.1.2.tgz","fileCount":5,"unpackedSize":4009,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD6aaSUlsG0AcWjdTntdUQp+D6rQx3QiZcdb/JkXfNe6QIhAPTsvNWufmiv/fa+INovP8x93KqFu4Q7P1/qld4vTi1U"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj5l4BACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmphsA//au9mZMNugMzzXjJJMkYA1emlwfa80+jByuOxqOUzbEnP3bey\r\nUQthwckBvJtOUqX0UmrYHkoCTJ4LatleMz3W+inCQKxGTgQrZVJaPs7JeDyG\r\nm8UeAu5JAvySIkvYKbNc/WI9Zr4voTZWrR03TyX5s8/K0H283ijI4q7swoOd\r\n3oGXuptHOLkOkwim2K2y9TQAfM/I3V+2eIoFR83rg5ZOAIZdlB+tFCvTe5Z3\r\nLySvno6m49a1XBSRPWNtMhlqeLbBaVx0kzvX++VY6/P1UC4tHDIYyBXv9ueM\r\ny2HPDhlOqBoJtESh7Hndc9+Jyc/ImA5Tkr7bW2cd3qC/YOakxBQ1u/7GHXkE\r\nlioCjBwR/HS2xTJ0NsCqVlQ+lMoE60iHxN64ok6f50U09xUHZWKlL5JDZdYE\r\n2nEutZsY2L8L5mlt45VGv3vFlNNqTRtHzlAkgol8dkL9RASUwuRPZppSrToR\r\nnUDgGk1CDpwhzQHsW8eyXIIZ9gwDHyUOLPQgSr/l8cVWGpzxUD3W6k7zOZkQ\r\n6s0YFwVIT/lxCAbLkL9ot8ALIm1ww6Us1arTXEEKs/GLbPJhN080Bg1Lk3gg\r\nWGp0yrQyCk4bGjr3rIrRX6xQyHJe9MSu4W0i/lxkx8JNBr9cdwrTu0X6ZeSL\r\nMdJIcPMjbDONuAhRHaPPfNPOcI19cJv43Yo=\r\n=+FUZ\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"aarondill","email":"AaronDill309@gmail.com"},"directories":{},"maintainers":[{"name":"aarondill","email":"AaronDill309@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/is-tagged_2.1.2_1676041729139_0.11907041309449928"},"_hasShrinkwrap":false}},"time":{"created":"2023-02-10T15:08:49.087Z","2.1.2":"2023-02-10T15:08:49.287Z","modified":"2023-02-10T15:08:49.449Z"},"maintainers":[{"name":"aarondill","email":"AaronDill309@gmail.com"}],"description":"Detect if a function is called as a tagged template or a regular function call","homepage":"https://github.com/aarondill/isTagged#readme","repository":{"type":"git","url":"git+https://github.com/aarondill/isTagged.git"},"author":{"name":"Aaron Dill"},"bugs":{"url":"https://github.com/aarondill/isTagged/issues"},"license":"ISC","readme":"# Check if a function is called by tagging!\n\n## Installation\n\nInstall from npm:\n`npm install @aarondill/is-tagged`\n\n## Usage\n\nImport the default export and call it using the _entire_ list of arguments to the function in question, stored in an Array or ArrayLike(has a length property) object.\n\nExample:\n\n```js\nimport isTagged from \"@aarondill/is-tagged\";\n\nfunction tag(...args) {\n\t// or `isTagged(arguments)`\n\tif (isTagged(args)) {\n\t\t// Do stuff with tag`hello world`\n\t\treturn true;\n\t} else {\n\t\t// Do stuff with tag(\"hello world\")\n\t\treturn false;\n\t}\n}\ntag`hello world`; // => true\ntag(\"hello world\"); //=> false\n```\n\n## Why?\n\nSometimes you want to provide two ways of calling a function:\n\n```js\nfunc`hello ${12}`;\nfunc(\"hello 12\");\n```\n\nIn order to implement any behavior allowing this, arguments must be processed _entirely_ differently.\nThis library helps this by allowing detection of the method in which the function was called\n\n## Special Feature:\n\n`isTagged` is a type-guard in TypeScript, allowing for better autocomplete and error management!\n\n**_Note:_** This only works if the arguments are stored in a non-internal variable(ie, not the arguments object). In order to use the arguments object with type-guarding, store it in a variable: `const args = arguments`\n","readmeFilename":"README.md"}