{"name":"jest-docblock","version":"25.2.3","license":"MIT","_id":"jest-docblock@25.2.3","maintainers":[{"name":"aaronabramov","email":"aaron@abramov.io"},{"name":"cpojer","email":"christoph.pojer@gmail.com"},{"name":"davidzilburg","email":"davidzilburg@gmail.com"},{"name":"fb","email":"opensource+npm@fb.com"},{"name":"rubennorte","email":"rubennorte@gmail.com"},{"name":"scotthovestadt","email":"scott.hovestadt@gmail.com"},{"name":"simenb","email":"sbekkhus91@gmail.com"}],"homepage":"https://github.com/facebook/jest#readme","bugs":{"url":"https://github.com/facebook/jest/issues"},"dist":{"shasum":"ac45280c43d59e7139f9fbe5896c6e0320c01ebb","tarball":"http://registry-npm.ywwl.com/jest-docblock/download/jest-docblock-25.2.3.tgz","fileCount":7,"integrity":"sha512-d3/tmjLLrH5fpRGmIm3oFa3vOaD/IjPxtXVOrfujpfJ9y1tCDB1x/tvunmdOVAyF03/xeMwburl6ITbiQT1mVA==","signatures":[{"sig":"MEYCIQCYCi560kDWu7FXp3aCm+3utfOAhqzWvUhlWfI2CqY60AIhAPX8cb8Wbw5+xxIPgV44+/oPsfgd3WkP357f0XehcHQ+","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10304,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJefQ+JCRA9TVsSAnZWagAAtYgP/3GJuFRpuy/O8J1iuV99\nr8oh7ENf5FICw3lwJRoamgfXzph6U/oKRlboq05OviAP0YGXiGsHpsIs0/vn\ncIXKhst1kZbc+7kRP06u0/BUB44lEprTZ6LYzWJc1PGJ5h79j0/6z02vIoou\nfPCTYvzi2QSwtycvDeHhMf+79auYVyI2UT2WJjbZ3bM30Rofax5nDf/XDyIo\nmMYg4cByY/IyQY7XWtS3O7ptlwag/Q6HmLRtNpWCAuuczxUL2dMOQ5GEL08m\nfnHDW2xeje0MSNmGa3VgQ39WjABYm7upwRlobIHQkDqyQqWlHeZx/SZIwVZY\nE3+XIwYZzDoazcyiYry+jbafoHVzDPxHU4D19dpiokSScdQGD2tfBklTydYj\nI0sSZaz4ZjY+ohhYvoNJ/ciGwdAGmjFNLQqHFX7ArRm+681Z61HrGTSaDsiz\nKhqSYMhRkP8w4ZZ/m/G2rR88YTCJst8FN3nwQ5rYrfQ1T5bnROJI9o5LRRm9\nBW8CzH9YnGaCZYUcwDYdbjkEwd2Y9Fu7ZYDC4rcr59zIMfV6Ff1u1Cc1AEQ4\nLl3X4lirgPryJVvrRbyD02hQiIUMBTOVXli7Rx5JBF6nzUWawspk2VxA1O+r\nzVbx2xFt/98KyRhCoqy/ecuM5EnJLqBG/lX5gN72sSNIn0Om8eLpl2J+OxZj\ntvu/\r\n=ZVUR\r\n-----END PGP SIGNATURE-----\r\n","size":3942,"noattachment":false,"key":"/jest-docblock/-/jest-docblock-25.2.3.tgz"},"main":"build/index.js","types":"build/index.d.ts","engines":{"node":">= 8.3"},"gitHead":"6f8bf80c38567ba076ae979af2dedb42b285b2d5","_npmUser":{"name":"simenb","email":"sbekkhus91@gmail.com"},"repository":{"url":"git+https://github.com/facebook/jest.git","type":"git","directory":"packages/jest-docblock"},"_npmVersion":"lerna/3.20.2/node@v12.14.1+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":"12.14.1","dependencies":{"detect-newline":"^3.0.0"},"publishConfig":{"access":"public"},"typesVersions":{"<3.8":{"build/*":["build/ts3.4/*"]}},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"*"},"_npmOperationalInternal":{"tmp":"tmp/jest-docblock_25.2.3_1585254281171_0.9900240777528733","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":1585254281277,"_cnpm_publish_time":1585254281277,"dist-tags":{"latest":"30.5.0","next":"30.0.0-rc.1"}}