{"name":"issue-parser","version":"2.1.0","keywords":["bitbucket","close","duplicate","fix","github","gitlab","issues","mentions","parser","pr","pull-request","references","resolve"],"author":{"url":"https://github.com/pvdlg","name":"Pierre Vanduynslager"},"license":"MIT","_id":"issue-parser@2.1.0","maintainers":[{"name":"pvdlg","email":"pierre.denis.vanduynslager@gmail.com"}],"homepage":"https://github.com/pvdlg/issue-parser#readme","bugs":{"url":"https://github.com/pvdlg/issue-parser/issues"},"xo":{"prettier":true},"nyc":{"all":true,"include":["lib/**/*.js","index.js"],"reporter":["json","text","html"]},"dist":{"shasum":"dc17db8ac697df3412ebd21bd43f4f0e904df983","tarball":"http://registry-npm.ywwl.com/issue-parser/download/issue-parser-2.1.0.tgz","fileCount":5,"integrity":"sha512-8kx7CnglqRnW7v+BzAppv9VMiUyEzzzYFD6oke9OcDQrdYObfCph1m+q3ZNQydxK+lEafG1hh5JQ+aaIxlsUFQ==","signatures":[{"sig":"MEUCIFKFzWuX6m2fKa/8FIPqlHi+k+C+PP3um8yyzu4TcxmSAiEA7HdFg9wXph6RjkZf6Vp4+7IqJmFzps23Y+b7vxtwQDk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":22189,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbQkJHCRA9TVsSAnZWagAAE0kP/AyFjpvVdeQiipQC0hEa\n+wXa3LmJoduWP1Fdd92lgaXZXduWqp9QCsmhfCl/QslNs2ws/IriHdsI685h\nq0O76GQJZt/DCU6JuLPU4OVoSKeDPO4G95jWF7tAzGgDqNtJL6HFcKbBx4n/\nY5tL6o90HoFWq//bELQTal6W9CVOVjUi1CaF5xoOo8fKOs1w9bjZTbc6+HHn\nsu7+nW58crcHX0bKmMeukYlE9/E+CjB+L0OxR/Zv7M4s48UixEGScfz3yRla\nuHMtfxcwSIBt6gEidrsDUdF1YENV+ikLanWwRkmn3oijSOTKmCWM8MCiehvY\nps5+YqQKw5BwXLRzUTqvEKYqR6ikhi2aAlNfHzVQCQxp9DRcxuRU3embgofA\nwvC0zm2T5ZTFz6tA7rF/TONzmliLPhbLm13FUKakI/U/i1RElLEl1/mXv5cz\nglSSc9LWeH29hCfhSHmd8wmU5iwfiyDOokswadmHXR77LVGGhXc4GOp4jou7\no5u5v7QXzjwrrjDsS6/1ZXMOZsVbAL5WgKg7KvIoiKzClyMLeTGxBY0PQQFx\nNTQQVTqkXRSdhH/uQM/mUqF3hDarn36Z8AS4XjDPKdCvsLp7hU/MNK3gxh2C\nwvtiiI0XPHiKVlO60E5OgbnON+kDJDpTj7Poo2aQrtvWoPaymYaMBE7BcuJ8\noLwz\r\n=du0u\r\n-----END PGP SIGNATURE-----\r\n","size":5506,"noattachment":false,"key":"/issue-parser/-/issue-parser-2.1.0.tgz"},"main":"index.js","files":["lib","index.js"],"engines":{"node":">=6"},"gitHead":"44822e6b899b94ef3ca1babb0a7f4f401bbf8148","scripts":{"lint":"xo","test":"xo && nyc ava -v","codecov":"codecov -f coverage/coverage-final.json","semantic-release":"semantic-release"},"_npmUser":{"name":"pvdlg","email":"pierre.denis.vanduynslager@gmail.com"},"prettier":{"printWidth":120,"trailingComma":"es5"},"repository":{"url":"git+https://github.com/pvdlg/issue-parser.git","type":"git"},"_npmVersion":"5.6.0","description":"Parser for Github, GitLab and Bitbucket issues actions, references and mentions","directories":{},"_nodeVersion":"8.11.3","dependencies":{"lodash.isstring":"^4.0.1","lodash.capitalize":"^4.2.1","lodash.escaperegexp":"^4.1.2","lodash.isplainobject":"^4.0.6"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"xo":"^0.21.0","ava":"^0.25.0","nyc":"^12.0.1","codecov":"^3.0.0","semantic-release":"^15.0.0"},"_npmOperationalInternal":{"tmp":"tmp/issue-parser_2.1.0_1531068999082_0.8096447783697867","host":"s3://npm-registry-packages"},"readme":"# issue-parser\n\nParser for [Github](https://github.com), [GitLab](https://gitlab.com) and [Bitbucket](https://bitbucket.org) issues actions, references and mentions\n\n<!--status-badges start -->\n\n[![Node CI Workflow Status][github-actions-ci-badge]][github-actions-ci-link]\n\n<!--status-badges end -->\n\nThe parser can identify:\n- GitHub [closing keywords](https://help.github.com/articles/closing-issues-using-keywords), [duplicate keyword](https://help.github.com/articles/about-duplicate-issues-and-pull-requests), [issue references](https://guides.github.com/features/issues/#notifications) and [user mentions](https://guides.github.com/features/issues/#notifications)\n- GitLab [closing keywords](https://docs.gitlab.com/ee/user/project/issues/automatic_issue_closing.html), [duplicate keyword](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12845), [issue references](https://about.gitlab.com/2016/03/08/gitlab-tutorial-its-all-connected) and [user mentions](https://about.gitlab.com/2016/03/08/gitlab-tutorial-its-all-connected)\n- Bitbucket [closing keywords](https://confluence.atlassian.com/bitbucket/resolve-issues-automatically-when-users-push-code-221451126.html), [issue references](https://confluence.atlassian.com/bitbucket/mark-up-comments-issues-and-commit-messages-321859781.html) and [user mentions](https://confluence.atlassian.com/bitbucket/mark-up-comments-issues-and-commit-messages-321859781.html)\n- [Custom](#custom-format) or [additional](#extend-existing-format) keywords\n\n## Install\n\n```bash\n$ npm install --save issue-parser\n```\n\n## Usage\n\n### GitHub format\n\n```js\nconst issueParser = require('issue-parser');\nconst parse = issueParser('github');\n\nparse('Issue description, ref user/package#1, Fix #2, Duplicate of #3 /cc @user');\n/*\n{\n  refs: [{raw: 'user/package#1', slug: 'user/package', prefix: '#', issue: '1'}],\n  actions: {\n    close: [{raw: 'Fix #2', action: 'Fix', prefix: '#', issue: '2'}],\n    duplicate: [{raw: 'Duplicate of #3', action: 'Duplicate of', prefix: '#', issue: '3'}],\n  },\n  mentions: [{raw: '@user', prefix: '@', user: 'user'}],\n}\n*/\n```\n\n### GitLab format\n\n```js\nconst issueParser = require('issue-parser');\nconst parse = issueParser('gitlab');\n\nparse('Issue description, ref group/user/package#1, !2, implement #3, /duplicate #4 /cc @user');\n/*\n{\n  refs: [\n    {raw: 'group/user/package#1', slug: 'group/user/package', prefix: '#', issue: '1'},\n    {raw: '!2', slug: 'group/user/package', prefix: '!', issue: '2'},\n  ],\n  actions: {\n    close: [{raw: 'implement #3', action: 'Implement', prefix: '#', issue: '4'}],\n    duplicate: [{raw: 'Duplicate of #4', action: 'Duplicate of', prefix: '#', issue: '4'}],\n  },\n  mentions: [{raw: '@user', prefix: '@', user: 'user'}],\n}\n*/\n```\n\n### Bitbucket format\n\n```js\nconst issueParser = require('issue-parser');\nconst parse = issueParser('bitbucket');\n\nparse('Issue description, ref user/package#1, fixing #2. /cc @user');\n/*\n{\n  refs: [{raw: 'user/package#1', slug: 'user/package', prefix: '#', issue: '1'}],\n  actions: {\n    close: [{raw: 'fixing #2', action: 'Fixing', prefix: '#', issue: '2'}],\n  },\n  mentions: [{raw: '@user', prefix: '@', user: 'user'}],\n}\n*/\n```\n\n### Custom format\n\n```js\nconst issueParser = require('issue-parser');\nconst parse = issueParser({actions: {fix: ['complete'], hold: ['holds up']}, issuePrefixes: ['🐛']});\n\nparse('Issue description, related to user/package🐛1, Complete 🐛2, holds up 🐛3');\n/*\n{\n  refs: [{raw: 'user/package🐛1', slug: 'user/package', prefix: '🐛', issue: '1'}],\n  actions: {\n    fix: [{raw: 'Complete 🐛2', action: 'Complete', prefix: '🐛', issue: '2'}],\n    hold: [{raw: 'holds up 🐛3', action: 'Holds up', prefix: '🐛', issue: '3'}],\n  },\n}\n*/\n```\n\n### Extend existing format\n\n```js\nconst issueParser = require('issue-parser');\nconst parse = issueParser('github', {actions: {parent: ['parent of'], related: ['related to']}});\n\nparse('Issue description, ref user/package#1, Fix #2, Parent of #3, related to #4 /cc @user');\n/*\n{\n  refs: [{raw: 'user/package#1', slug: 'user/package', prefix: '#', issue: '1'}],\n  actions: {\n    close: [{raw: 'Fix #2', action: 'Fix', prefix: '#', issue: '2'}],\n    parent: [{raw: 'Parent of #3', action: 'Parent of', prefix: '#', issue: '3'}],\n    related: [{raw: 'related to #4', action: 'Related to', prefix: '#', issue: '4'}],\n  },\n  mentions: [{raw: '@user', prefix: '@', user: 'user'}],\n}\n*/\n```\n\n## Features\n\n### Parse references\n\n```text\n#1\n```\n```js\n{refs: [{raw: '#1', slug: undefined, prefix: '#', issue: '1'}]}\n```\n\n### Parse repository slug\n\n```text\nowner/repo#1\n```\n```js\n{refs: [{raw: 'owner/repo#1', slug: 'owner/repo', prefix: '#', issue: '1'}]}\n```\n\n### Parse closing keywords\n\n```text\nFix #1\n```\n```js\n{actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]}}\n```\n\n### Parse duplicate keywords\n\n```text\nDuplicate of #1\n```\n```js\n{actions: {duplicate: [{raw: 'Duplicate of #1', action: 'Duplicate of', slug: undefined, prefix: '#', issue: '1'}]}}\n```\n\n### Parse user mentions\n\n```text\n@user\n```\n```js\n{mentions: [{raw: '@user', prefix: '@', user: 'user'}]}\n```\n\n### Parse references with full issue URL\n\n```text\nhttps://github.com/owner/repo/pull/1\n\nFix https://github.com/owner/repo/issues/2\n```\n```js\n{\n  refs: [{raw: 'https://github.com/owner/repo/pull/1', slug: 'owner/repo', prefix: undefined, issue: '1'},]\n  actions: {\n    close: [\n      {raw: 'Fix https://github.com/owner/repo/issues/2', action: 'Fix', slug: 'owner/repo', prefix: undefined, issue: '2'}\n    ]\n  }\n}\n```\n\n### Ignore keywords case\n\n```text\nFIX #1\n```\n```js\n{actions: {close: [{raw: 'FIX #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]}}\n```\n\n### Support delimiters between action keyword and issue\n\n```text\nFix: #1\n```\n```js\n{actions: {close: [{raw: 'Fix: #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]}}\n```\n\n### Ignore references in back-tick quotes\n\n```text\nFix #1 `Fix #2` @user1 `@user2`\n```\n```js\n{\n  actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]},\n  mentions: [{raw: '@user1', prefix: '@', user: 'user1'}]\n}\n```\n\n### Include references in escaped back-tick quotes\n\n```text\n\\`Fix #1\\` \\`@user\\`\n```\n```js\n{\n  actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]},\n  mentions: [{raw: '@user1', prefix: '@', user: 'user1'}]\n}\n```\n\n### Ignore references in fenced blocks\n\n````text\nFix #1\n\n```js\nconsole.log('Fix #2');\n```\n\n@user1\n\n```js\nconsole.log('@user2');\n```\n````\n```js\n{\n  actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]},\n  mentions: [{raw: '@user1', prefix: '@', user: 'user1'}]\n}\n```\n\n### Include references in escaped fenced blocks\n\n```text\n\\`\\`\\`\nFix #1\n\\`\\`\\`\n\n\\`\\`\\`\n@user\n\\`\\`\\`\n```\n```js\n{\n  actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]},\n  mentions: [{raw: '@user', prefix: '@', user: 'user'}]\n}\n```\n\n### Ignore references in &lt;code&gt; tags\n\n```text\nFix #1\n<code>Fix #2</code>\n<code><code>Fix #3</code></code>\n@user1\n<code>@user2</code>\n```\n```js\n{\n  actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]},\n  mentions: [{raw: '@user1', prefix: '@', user: 'user1'}]\n}\n```\n\n### Include references in escaped &lt;code&gt; tags\n\n```text\n`<code>`Fix #1`</code>`\n`<code>`@user`</code>`\n```\n```js\n{\n  actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]},\n  mentions: [{raw: '@user', prefix: '@', user: 'user'}]\n}\n```\n\n### Ignore malformed references\n\n```text\nFix #1 Fix #2a Fix a#3\n```\n```js\n{actions: {close: [{raw: 'Fix #1', action: 'Fix', slug: undefined, prefix: '#', issue: '1'}]}}\n```\n\n## API\n\n### issueParser([options], [overrides]) => parse\n\nCreate a [parser](#parsetext--result).\n\n#### options\n\nType: `Object` `String`<br>\nParser options. Can be `github`, `gitlab` or `bitbucket` for predefined options, or an object for custom options.\n\n##### actions\n\nType: `Object`<br>\nDefault:\n`{close: ['close', 'closes', 'closed', 'closing', 'fix', 'fixes', 'fixed', 'fixing', 'resolve', 'resolves', 'resolved', 'resolving', 'implement', 'implements', 'implemented', 'implementing'],\n  duplicate: ['Duplicate of', '/duplicate']}`\n\nObject with type of action as key and array of keywords as value.\n\nEach keyword match will be placed in the corresponding property of the [`result`](#result) `action` object. For example the with the configuration `{actions: fix: ['fixed', 'fixing']}` each action matching `fixed` or  `fixing` will be under `result.actions.fix`.\n\n##### delimiters\n\nType: `Array<String>` `String`<br>\nDefault: `[':']`\n\nList of delimiter characters allowed between an action keywords and the issue reference. The characters space (` `) and tab (`  `) are always allowed.\n\n##### mentionsPrefixes\n\nType: `Array<String>` `String`<br>\nDefault: `['@']`\n\nList of keywords used to identify user mentions.\n\n##### issuePrefixes\n\nType: `Array<String>` `String`<br>\nDefault: `['#', 'gh-']`\n\nList of keywords used to identify issues and pull requests.\n\n##### hosts\n\nType: `Array<String>` `String`<br>\nDefault: `['https://github.com', 'https://gitlab.com']`\n\nList of base URL used to identify issues and pull requests with [full URL](#parse-references-with-full-issue-url).\n\n##### issueURLSegments\n\nType: `Array<String>` `String`<br>\nDefault: `['issues', 'pull', 'merge_requests']`\n\nList of URL segment used to identify issues and pull requests with [full URL](#parse-references-with-full-issue-url).\n\n#### overrides\n\nType: `Object`<br>\nOption overrides. Useful when using predefined [`options`](#options) (such as `github`, `gitlab` or `bitbucket`). The `overrides` object can define the same properties as [`options`](#options).\n\nFor example, the following will use all the `github` predefined options but with a different `hosts` option:\n```js\nconst issueParser = require('issue-parser');\nconst parse = issueParser('github', {hosts: ['https://custom-url.com']});\n```\n\n### parse(text) => Result\n\nParse an issue description and returns a [Result](#result) object.\n\n#### text\n\nType: `String`\n\nIssue text to parse.\n\n### Result\n\n#### actions\n\nType: `Object`\n\nList of matching actions by type.<br>\nEach type of action is an array of objects with the following properties:\n\n| Name   | Type     | Description                                                                           |\n|--------|----------|---------------------------------------------------------------------------------------|\n| raw    | `String` | The raw value parsed, for example `Fix #1`.                                           |\n| action | `String` | The keyword used to identify the action, capitalized.                                 |\n| slug   | `String` | The repository owner and name, for issue referred as `<owner>/<repo>#<issue number>`. |\n| prefix | `String` | The prefix used to identify the issue.                                                |\n| issue  | `String` | The issue number.                                                                     |\n\n#### refs\n\nType: `Array<Object>`\n\nList of issues and pull requests referenced, but not matched with an action.<br>\nEach reference has the following properties:\n\n| Name   | Type     | Description                                                                           |\n|--------|----------|---------------------------------------------------------------------------------------|\n| raw    | `String` | The raw value parsed, for example `#1`.                                               |\n| slug   | `String` | The repository owner and name, for issue referred as `<owner>/<repo>#<issue number>`. |\n| prefix | `String` | The prefix used to identify the issue.                                                |\n| issue  | `String` | The issue number.                                                                     |\n\n#### mentions\n\nType: `Array<Object>`\n\nList of users mentioned.<br>\nEach mention has the following properties:\n\n| Name   | Type     | Description                                 |\n|--------|----------|---------------------------------------------|\n| raw    | `String` | The raw value parsed, for example `@user`.  |\n| prefix | `String` | The prefix used to identify the mention.    |\n| user   | `String` | The user name                               |\n\n#### allRefs\n\nType: `Array<Object>`\n\nList of all issues and pull requests [referenced](#refs) or matching an [action](#actions-1).<br>\nEach reference has the following properties:\n\n| Name   | Type     | Description                                                                                          |\n|--------|----------|------------------------------------------------------------------------------------------------------|\n| raw    | `String` | The raw value parsed, for example `Fix #1`.                                                          |\n| action | `String` | The keyword used to identify the action or the duplicate, capitalized. Only if matched by an action. |\n| slug   | `String` | The repository owner and name, for issue referred as `<owner>/<repo>#<issue number>`.                |\n| prefix | `String` | The prefix used to identify the issue.                                                               |\n| issue  | `String` | The issue number.                                                                                    |\n\n\n[github-actions-ci-link]: https://github.com/semantic-release/issue-parser/actions/workflows/test.yml\n\n[github-actions-ci-badge]: https://github.com/semantic-release/issue-parser/actions/workflows/test.yml/badge.svg\n","publish_time":1531068999168,"_cnpm_publish_time":1531068999168,"dist-tags":{"beta":"8.0.0-beta.1","latest":"7.0.2"}}