{"name":"jest-docblock","version":"27.5.0","license":"MIT","_id":"jest-docblock@27.5.0","maintainers":[{"name":"scotthovestadt","email":"scott.hovestadt@gmail.com"},{"name":"rubennorte","email":"rubennorte@gmail.com"},{"name":"simenb","email":"sbekkhus91@gmail.com"},{"name":"fb","email":"opensource+npm@fb.com"},{"name":"aaronabramov","email":"aaron@abramov.io"},{"name":"davidzilburg","email":"davidzilburg@gmail.com"}],"homepage":"https://github.com/facebook/jest#readme","bugs":{"url":"https://github.com/facebook/jest/issues"},"dist":{"shasum":"096fa3a8b55d019a954ef7cc205c791bf94b2352","tarball":"http://registry-npm.ywwl.com/jest-docblock/download/jest-docblock-27.5.0.tgz","fileCount":5,"integrity":"sha512-U4MtJgdZn2x+jpPzd7NAYvDmgJAA5h9QxVAwsyuH7IymGzY8VGHhAkHcIGOmtmdC61ORLxCbEhj6fCJsaCWzXA==","signatures":[{"sig":"MEUCIQCvBIC9++Hz5mgbAj+SuDA4zuhh3biyAKIySFDAklBtCgIgNAUgCKTELqZgNi0Yf3XlmD3zHj10bplWYJxLhhFjbWg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9080,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh/kp1CRA9TVsSAnZWagAAN/MP/jQFCRFeRmAiTbscEYYr\nWwrLDDt5fS/A5kSlAQCVmR4eMEVXW00EsQzdgAZ0CAuXOxYfUvLSRh/Sagvt\ni3xaQ5TWxezQwoCxqt0tl7GJmPGUMDyu/G3AGZWJQ74O3R7k7mbZEgWbLKkp\n9iZwqO2eAtr+bg4mv6wW+1D/Dtwtm6cmSCv7NpuRYiLkC86wXS84uBxqavN8\nUpnxqOz/qR5IKkXUkXOWdQvJK6tb8lg7Uos7g/u29K0WKEsTZ43jlZFXKM2y\nvIxL1Kd0xCxrsR4dOjy/6cnxtKCkrHs9dbpxRzHSG1JbkMsn00rTYog0YTtL\niLBsv8tyi0xVRZD32RxF9Y8zHaMM7MTZRcKYvXCbg25HisNMmX22BKFW05Mi\nFV3cJ8/rVnOSBofqFQrhmnBfy8Q/fewDvDra2xH8VCEtObUGthtS4ayOO810\nHygdol5WI2xs9avO0XsDpRsvVODbxU+nZ8EZNvwph+XOqR2b+oiGgqOT5GlZ\nYHke/+aQ/oKc6rlrfFNHzEtMAQjDs0X93ePE9cASoM2Orp201PnPFYEcwvvX\n5cs2SYh7GQ1RLj6cQp1cggRWax8sBS5dHQM70IcOARsAnIYM8XutjCf/XHJ7\n44Tg+/CYi7asU1SApeNwr/plxk/a96zIK+sFRf+2VRTcQTz+uhW5O6susK30\nqsPH\r\n=NX6T\r\n-----END PGP SIGNATURE-----\r\n","size":3592,"noattachment":false,"key":"/jest-docblock/-/jest-docblock-27.5.0.tgz"},"main":"./build/index.js","types":"./build/index.d.ts","engines":{"node":"^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"},"exports":{".":{"types":"./build/index.d.ts","default":"./build/index.js"},"./package.json":"./package.json"},"gitHead":"247cbe6026a590deaf0d23edecc7b2779a4aace9","_npmUser":{"name":"simenb","email":"sbekkhus91@gmail.com"},"repository":{"url":"git+https://github.com/facebook/jest.git","type":"git","directory":"packages/jest-docblock"},"_npmVersion":"lerna/4.0.0/node@v16.13.2+x64 (darwin)","description":"`jest-docblock` is a package that can extract and parse a specially-formatted comment called a \"docblock\" at the top of a file.","directories":{},"_nodeVersion":"16.13.2","dependencies":{"detect-newline":"^3.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"*"},"_npmOperationalInternal":{"tmp":"tmp/jest-docblock_27.5.0_1644055157741_0.44295075307886855","host":"s3://npm-registry-packages"},"readme":"# jest-docblock\n\n`jest-docblock` is a package that can extract and parse a specially-formatted comment called a \"docblock\" at the top of a file.\n\nA docblock looks like this:\n\n```js\n/**\n * Stuff goes here!\n */\n```\n\nDocblocks can contain pragmas, which are words prefixed by `@`:\n\n```js\n/**\n * Pragma incoming!\n *\n * @flow\n */\n```\n\nPragmas can also take arguments:\n\n```js\n/**\n * Check this out:\n *\n * @myPragma it is so cool\n */\n```\n\n`jest-docblock` can:\n\n- extract the docblock from some code as a string\n- parse a docblock string's pragmas into an object\n- print an object and some comments back to a string\n\n## Installation\n\n```sh\n# with yarn\n$ yarn add jest-docblock\n# with npm\n$ npm install jest-docblock\n```\n\n## Usage\n\n```js\nconst code = `\n/**\n * Everything is awesome!\n *\n * @everything is:awesome\n * @flow\n */\n\n export const everything = Object.create(null);\n export default function isAwesome(something) {\n   return something === everything;\n }\n`;\n\nconst {\n  extract,\n  strip,\n  parse,\n  parseWithComments,\n  print,\n} = require('jest-docblock');\n\nconst docblock = extract(code);\nconsole.log(docblock); // \"/**\\n * Everything is awesome!\\n * \\n * @everything is:awesome\\n * @flow\\n */\"\n\nconst stripped = strip(code);\nconsole.log(stripped); // \"export const everything = Object.create(null);\\n export default function isAwesome(something) {\\n return something === everything;\\n }\"\n\nconst pragmas = parse(docblock);\nconsole.log(pragmas); // { everything: \"is:awesome\", flow: \"\" }\n\nconst parsed = parseWithComments(docblock);\nconsole.log(parsed); // { comments: \"Everything is awesome!\", pragmas: { everything: \"is:awesome\", flow: \"\" } }\n\nconsole.log(print({pragmas, comments: 'hi!'})); // /**\\n * hi!\\n *\\n * @everything is:awesome\\n * @flow\\n */;\n```\n\n## API Documentation\n\n### `extract(contents: string): string`\n\nExtracts a docblock from some file contents. Returns the docblock contained in `contents`. If `contents` did not contain a docblock, it will return the empty string (`\"\"`).\n\n### `strip(contents: string): string`\n\nStrips the top docblock from a file and return the result. If a file does not have a docblock at the top, then return the file unchanged.\n\n### `parse(docblock: string): {[key: string]: string | string[] }`\n\nParses the pragmas in a docblock string into an object whose keys are the pragma tags and whose values are the arguments to those pragmas.\n\n### `parseWithComments(docblock: string): { comments: string, pragmas: {[key: string]: string | string[]} }`\n\nSimilar to `parse` except this method also returns the comments from the docblock. Useful when used with `print()`.\n\n### `print({ comments?: string, pragmas?: {[key: string]: string | string[]} }): string`\n\nPrints an object of key-value pairs back into a docblock. If `comments` are provided, they will be positioned on the top of the docblock.\n","publish_time":1644055157865,"_cnpm_publish_time":1644055157865,"dist-tags":{"latest":"30.5.0","next":"30.0.0-rc.1"}}