{"_id":"@qvvg/templar","_rev":"3-9640577605eaa9f706d1fd618ec73149","name":"@qvvg/templar","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.0":{"name":"@qvvg/templar","version":"0.0.0","description":"tagged template literals","author":{"name":"James Hunter","email":"github@qv.vg"},"license":"MIT","source":"src/templar.js","main":"dist/templar.js","module":"dist/templar.mjs","unpkg":"dist/templar.umd.js","jest":{"transform":{".js":"jest-esm-transformer"}},"devDependencies":{"jest":"^25.1.0","jest-esm-transformer":"^1.0.0","microbundle":"^0.11.0"},"scripts":{"prepublishOnly":"npm run build","build":"microbundle","dev":"microbundle watch","test":"jest"},"gitHead":"61e2cba3531ce62c7a73e0eb120e558ad75bad1e","_id":"@qvvg/templar@0.0.0","_nodeVersion":"13.7.0","_npmVersion":"6.13.6","dist":{"integrity":"sha512-0UMialbLrrCD64ujTHE59eLsS6/IWLvwrRMlw2kkq4hRLyL1GkO+gcBPkUObI7AvP44BIg4pF6hnyEpO5sRldQ==","shasum":"8bd4a5485100be0721f8e8cad1139b1a133b73d0","tarball":"https://registry.npmjs.org/@qvvg/templar/-/templar-0.0.0.tgz","fileCount":12,"unpackedSize":13970,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeNHjzCRA9TVsSAnZWagAA3CwP/0iSNeDNTaeIplPRD9cj\nehFHo7jOkKVFOiYT4kxIWvTL4P7imFtJtRDmfrc+SaTQ20Hhv5CU6f9D9ICn\nKFegNODgGDwwtNLykxRriZ8L333NdenLyfK77VeI3FYvKpizgsH/Zdzj3vA0\nwPbY+05aAdnsTOjVVo38EfPNVLs/0N+oF9CE+h0thozZUb1pBeydPgkq/6LJ\nu0m1eXN6wWhqRvBAugYHSgFVhgnZDHUSR/W6EtIeeD/cnWFDi9AHI3E5JZoJ\nrr4YmAymwjM3B1Yi7GrtEIFM01rTvhjO86W/1gukXYLiavojXtUJQC8KU4Eh\nQ2TeOndNPzmJTl6muRSfaXEcQ2PtF8SIiJcxU1G4Zbcvbg1EwjS49X3NLknd\nKaW9PJvJumj/ekjW2XIXyoWTrgfjaTDLkbLlrdxrjXKSwPcCnhXD+Jiqk7yQ\nZORzFtC1xJiqd698WywldztquppbacmafSiOjH/Az04PmawVoyqnXEXB7YU3\nY3fr1eLQ0Fr683TyoAWbP8w5wrbgO2nfX5P1BfklfbHB28+fjdBPnl4oXTG2\nmwLI19x8wakNDKe4nrMkUMUeA9koRLjFwnEvDnw7AnlLRnXlUaF8g1bjPDnr\nDrCq9/TTs809/IivwlQsCKjosdz/OPc3ntlfJbUFPVBTXja+hCQEJj93aKTj\nwLfk\r\n=DEwu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDtav0U1Ydff+YCPcq8vfuqW7eSFUEs6FAZy2vI6iE1agIgO6SAVzmDqUyTDlWTa//g79kwCQ0dWmMTCnTrovrhNo8="}]},"maintainers":[{"name":"qvvg","email":"npm@qv.vg"}],"_npmUser":{"name":"qvvg","email":"npm@qv.vg"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/templar_0.0.0_1580497138880_0.9583684910078476"},"_hasShrinkwrap":false},"0.0.1":{"name":"@qvvg/templar","version":"0.0.1","description":"tagged template literals","author":{"name":"James Hunter","email":"github@qv.vg"},"license":"MIT","main":"dist/templar.cjs.js","module":"dist/templar.js","repository":{"type":"git","url":"git+https://github.com/orodio/qvvg-templar.git"},"jest":{"transform":{".js":"jest-esm-transformer"}},"devDependencies":{"jest":"26.0.1","jest-esm-transformer":"1.0.0","rollup":"1.20.3","rollup-plugin-babel-minify":"9.0.0"},"scripts":{"prepublishOnly":"npm test && npm run build","build":"rollup -c","dev":"microbundle watch","test":"jest"},"gitHead":"16905f5d380ee4b8c0286944e3e05e921431522a","bugs":{"url":"https://github.com/orodio/qvvg-templar/issues"},"homepage":"https://github.com/orodio/qvvg-templar#readme","_id":"@qvvg/templar@0.0.1","_nodeVersion":"13.7.0","_npmVersion":"6.14.0","dist":{"integrity":"sha512-BKrwiOQqIEKx1GwxZhCROo4M5Etn4wAvR++op4QzGobLK9i8hXzUL653vfM4mNAdxjbTUABHdBRuVX81qSjFcw==","shasum":"dde30e82931f455eef6a5abe254a43d5519d21ac","tarball":"https://registry.npmjs.org/@qvvg/templar/-/templar-0.0.1.tgz","fileCount":5,"unpackedSize":5665,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJevrhACRA9TVsSAnZWagAAMloP/2sYWnry9r/90XdnkzE/\nMn9wgP4FxHpY+enLy33S5jkZTPjGOiPR9FKT+gfodq2xLKObWrZpzr5PI4Pr\n7UftaAqzlEeDG2ZA4qjGvfjJ7PixBScg8ER24QHirZkwEctu0n5qFnCqT9Jl\nGcVgy3iW119YyVMiXRO7Fn4knHh9XlBSGxjCAyy4vosMyEV87TEHvzIAafxH\n7BWi/l/yNNhJrvTDlLMAVeMq7IsphlsXpaBmyFNI9IPb0a+6JPE09ni9wSdR\nmvWhjNbCtNV3WIdhBeK/hjm5fc0/NPydTT52hTIXUFHjCKieFIL0uHrfV11G\nkmte04UveP6iGqN1fwkS9mZ2+xE5NcKECj8uRtnWzC9d7cOyS9DOE6KQYXJs\nqQRM2UOAX1zcUcTLuuHIFjgZB98f1W4wWhb8ue0ic6KrT/jb3hJvbKOhP+v8\niOwueGselAYwQP7q5NKrhPJ4GihJRGcsP9PaF8RZg+m9V+3cDAfWUHNBZ4Ik\nz6dUuuIQ3yvbmMAwdQpMMivpKNMtIrK9vPkSiYPLVonOt9MxuOBHB7/u1uSi\ntzAjU6Vc8gLPXsZKlbGiEv33jCvhqUv8TTdoz8jNY9tGXXYmUVY6p6QXxE6m\noi/MBn6AhSnrRvvR2wZpbL6ukiHjD7+/Jhyw9oDwPEtMy+n78lYzuofMQQXV\nSw0q\r\n=5zLK\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBpqVrz8if2xsCgD0SuxIg70BIw/+H13ljeH3/bitvw2AiEAuybSA2qNxdEml0IDvnHnSsup6xq6b/PwAdDSeuzAI5Y="}]},"maintainers":[{"name":"qvvg","email":"npm@qv.vg"}],"_npmUser":{"name":"qvvg","email":"npm@qv.vg"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/templar_0.0.1_1589557311443_0.2575705248726379"},"_hasShrinkwrap":false},"0.0.2":{"name":"@qvvg/templar","version":"0.0.2","description":"tagged template literals","author":{"name":"James Hunter","email":"github@qv.vg"},"license":"MIT","main":"dist/templar.cjs.js","module":"dist/templar.js","repository":{"type":"git","url":"git+https://github.com/orodio/qvvg-templar.git"},"jest":{"transform":{".js":"jest-esm-transformer"}},"devDependencies":{"jest":"26.0.1","jest-esm-transformer":"1.0.0","rollup":"1.20.3","rollup-plugin-babel-minify":"9.0.0"},"scripts":{"prepublishOnly":"npm test && npm run build","build":"rollup -c","dev":"microbundle watch","test":"jest"},"gitHead":"850c81204b2b8a42ae736a100adb94f12f11b696","bugs":{"url":"https://github.com/orodio/qvvg-templar/issues"},"homepage":"https://github.com/orodio/qvvg-templar#readme","_id":"@qvvg/templar@0.0.2","_nodeVersion":"13.7.0","_npmVersion":"6.14.0","dist":{"integrity":"sha512-0yUe8P474lCURIOIxGd0bfNErhUFyk0pSZgaWvMVtt9f1rVRb+gag8VCpG7bW2dpvEh6AM7zZryXc35JmQZhug==","shasum":"5f49b5fa03cd2ebb45b4e8ebed2fcff7d1baaae7","tarball":"https://registry.npmjs.org/@qvvg/templar/-/templar-0.0.2.tgz","fileCount":5,"unpackedSize":5717,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJevrzXCRA9TVsSAnZWagAAyoQP/1GOdZt1/6a8Jvw9EsQ4\nLVsep/5XWvlYpoGJwErgucb2bu0NzM4LNrH/aDCTi8K9SSRw+HCkUd+j7ZKI\nEht1OXWfABoaXJsOsDhDNXz2gbEVIot2f69obJXiriREkT47zZZ71VZ60Vai\nT4LDlzxa7AvlWVLD+n1e1RorzHv544mCf2aFbuiP4o9WjeQD9U/1AqF/Yygg\nPFm0IsX5BqA6QQ4YKTWKEMgWswd1ffxzvZbWIPBUdZ0klwqVkWB60N3gwsa8\npb+yTEn99bj1fr8Gm2vhxSlphpzXH1gi0GNPtvlwsNlnsvR8I0CQffk2L35b\njmTOqV6JLfCcwhhcf0X8BVUM6dnIRag9LZzDT+M7rsAYJMAIIv1NVs/sYNFu\nJZRai4ZQLv4Dv7Bi/m/tolHRo70dpmDhEIZmgm9rElC4f8/fCkH7lr+FIJdK\nrrBS6J3Q6EBaVKEsHmcFElEsQDFpGUEpCgb8muPWYgziVCgOFZD3DS8wQNJq\nd8I2TXuXG9mb8YOvWBbAYw5qfFOZcwQhMdZvy0dZrQfF0I1T7E1xfkfUilJ2\nagOYKtFpmyGtUp0IewxBnv3pDfX8p7NOBh7uWKTWa6PXwvqap2KhPMuglbTj\nGmByEX9ZL9tadXAaWIjLIeL4QjuO+ZxTLaDJyO3vf6J+euFEL6n0A2Yypxmy\n7kDH\r\n=gdIQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC3SqD4u8ARsCO4CNURLnA3jRtvYVNOg2WKGtPlomOzKQIgZrGxQrcN51vspTSyM1J/uEoO2RatC3zhE7kodFqiQ6g="}]},"maintainers":[{"name":"qvvg","email":"npm@qv.vg"}],"_npmUser":{"name":"qvvg","email":"npm@qv.vg"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/templar_0.0.2_1589558487328_0.7411854173857975"},"_hasShrinkwrap":false}},"time":{"created":"2020-01-31T18:58:58.834Z","0.0.0":"2020-01-31T18:58:58.986Z","modified":"2022-04-06T17:47:34.501Z","0.0.1":"2020-05-15T15:41:51.620Z","0.0.2":"2020-05-15T16:01:27.518Z"},"maintainers":[{"name":"qvvg","email":"npm@qv.vg"}],"description":"tagged template literals","author":{"name":"James Hunter","email":"github@qv.vg"},"license":"MIT","readme":"# templar\n\n> use them backticks, because they are a thing now\n\n## Usage\n\n```javascript\nimport {templar} from \"@qvvg/templar\"\n\nconst template = templar`\nFrom: ${o => o.from}\nTo: ${o => o.to}\nMessage: ${o => o.msg}\n`\n\nconst letter = template({\n  from: \"Bob the Builder\",\n  to: \"Postman Pat\",\n  msg: \"Please pick up your black and white cat.\",\n})\n\n// prettier-ignore\nassert( letter, `\nFrom: Bob the Builder\nTo: Postman Pat\nMessage: Please pick up your black and white cat.\n`)\n```\n\n```javascript\nimport {templar} from \"@qvvg/templar\"\n\nconst template1 = templar`\na: ${o => o.a}\nb: ${o => o.b}\n`\n\nconst template2 = templar`\nx: ${o => o.x}\ny: ${o => o.y}\n`\n\nconst template3 = templar`\n${template1}\n${template2}\noh hello!\n${template1}\n${template2}\n`\n\nconst rawr = template3({a: \"A\", b: \"B\", x: \"X\", y: \"Y\"})\n\n// prettier-ignore\nassert(rawr, `\na: A\nb: B\nx: X\ny: Y\noh hello!\na: A\nb: B\nx: X\ny: Y\n`)\n```\n\n## Examples\n\n**Role your own graphql libary**\n\n```javascript\n// gql.js\nimport {templar} from \"@qvvg/templar\"\n\nexport const gql = templar\n\nexport const gqlr = (...args) => (opts = {}) => {\n  const params = opts.params || {}\n  const headers = opts.headers || {}\n  const endpoint = opts.endpoint || \"\"\n\n  return fetch(endpoint, {\n    method: \"POST\",\n    headers: {\n      \"Content-Type\": \"application/json\",\n      ...headers,\n    },\n    body: JSON.stringify({\n      query: gql(...args)(params),\n    }),\n  }).then(d => d.json())\n}\n\n// somewhere-else.js\nimport React, {useEffect, useState} from \"react\"\nimport {gqlr, gql} from \"./gql\"\n\nconst USER = gql`\n  fragment USER on User {\n    username\n  }\n`\n\nconst query = gqlr`\n  query {\n    me { ...USER }\n  }\n  ${USER}\n`\n\nexport const Username = () => {\n  const [username, setUsername] = useState(null)\n\n  useEffect(() => {\n    query({\n      endpoint: \"http://...\",\n      headers: {authorization: \"bearer ...\"},\n    }).then(response => setUsername(response.data.me.username))\n  }, [])\n\n  return username == null ? null : username\n}\n```\n\n**Role your own pipeline thing?**\n\n```javascript\nconst pipe = (fns = []) => token => {\n  return fns.reduce((token, fn) => fn(token), token)\n}\n\nconst param = (key, value) => token => {\n  token.params = token.parms || {}\n  token.params[key] = value\n  return token\n}\n\nconst script = (...args) => token => {\n  token.type = \"script\"\n  token.value = templar(...args)(token.params)\n  return token\n}\n\nconst query = (...args) => token => {\n  token.type = \"query\"\n  token.value = templar(...args)(token.parms)\n  return token\n}\n\nconst desc = (...args) => token => {\n  token.description = templar(...args)(token.params)\n  return token\n}\n\nconst rawr = pipe([\n  param(\"msg\", \"woot woot im a boot\"),\n  script`\n    pub fun main() {\n      log(\"msg: ${o => o.msg}\")\n    }\n  `,\n  desc`\n    the message: ${o => o.msg}\n  `,\n])\n\nassert(rawr, {\n  params: {\n    msg: \"woot woot im a boot\",\n  },\n  type: \"script\",\n  code: `\n    pub fun main() {\n      log(\"msg: woot woot im a boot\")\n    }\n  `,\n  descrition: `\n    the message: woot woot im a boot\n  `,\n})\n```\n","readmeFilename":"README.md","homepage":"https://github.com/orodio/qvvg-templar#readme","repository":{"type":"git","url":"git+https://github.com/orodio/qvvg-templar.git"},"bugs":{"url":"https://github.com/orodio/qvvg-templar/issues"}}