parse-commit-message
Advanced tools
Comparing version
@@ -6,2 +6,14 @@ # Change Log | ||
# [4.0.0-canary.20200124.5](https://github.com/tunnckoCore/opensource/compare/parse-commit-message@4.0.0-canary.20200124.4...parse-commit-message@4.0.0-canary.20200124.5) (2020-02-04) | ||
### Bug Fixes | ||
* docs runner, regen docs, and create-jest-runner updates ([d854e3d](https://github.com/tunnckoCore/opensource/commit/d854e3d335fa1d2c82d87321a07c6659fe6dcee1)) | ||
* dooh, readmes and bugs ([871666e](https://github.com/tunnckoCore/opensource/commit/871666e7eabbca6bf65cbc257311f0a46d410752)) | ||
# [4.0.0-canary.20200124.4](https://github.com/tunnckoCore/opensource/compare/parse-commit-message@4.0.0-canary.20200124.3...parse-commit-message@4.0.0-canary.20200124.4) (2020-02-04) | ||
@@ -8,0 +20,0 @@ |
{ | ||
"name": "parse-commit-message", | ||
"version": "4.0.0-canary.20200124.4", | ||
"version": "4.0.0-canary.20200124.5", | ||
"licenseStart": 2018, | ||
@@ -104,3 +104,3 @@ "license": "MPL-2.0", | ||
}, | ||
"gitHead": "36720fdd18247b0ce9134b9631a6d5848e6c6c0d" | ||
"gitHead": "66acb69b616e923f601e632bfe398c07d86fa739" | ||
} |
416
README.md
@@ -0,5 +1,6 @@ | ||
# parse-commit-message [![npm version][npmv-img]][npmv-url] [![License][license-img]][license-url] [![Libera Manifesto][libera-manifesto-img]][libera-manifesto-url] | ||
> Extensible parser for git commit messages following Conventional Commits | ||
> Specification | ||
> Extensible parser for git commit messages following Conventional Commits Specification | ||
@@ -63,32 +64,33 @@ Please consider following this project's author, | ||
- [Install](#install) | ||
- [isBreakingChangePlugin](#isbreakingchangeplugin) | ||
- [mentionsPlugin](#mentionsplugin) | ||
- [.parseHeader](#parseheader) | ||
- [.stringifyHeader](#stringifyheader) | ||
- [.validateHeader](#validateheader) | ||
- [.checkHeader](#checkheader) | ||
- [.applyPlugins](#applyplugins) | ||
- [.plugins](#plugins) | ||
- [.mappers](#mappers) | ||
- [.parseCommit](#parsecommit) | ||
- [.stringifyCommit](#stringifycommit) | ||
- [.validateCommit](#validatecommit) | ||
- [.checkCommit](#checkcommit) | ||
- [.parse](#parse) | ||
- [.stringify](#stringify) | ||
- [.validate](#validate) | ||
- [.check](#check) | ||
- [incrementPlugin](#incrementplugin) | ||
- [API](#api) | ||
* [isBreakingChangePlugin](#isbreakingchangeplugin) | ||
* [mentionsPlugin](#mentionsplugin) | ||
* [.parseHeader](#parseheader) | ||
* [.stringifyHeader](#stringifyheader) | ||
* [.validateHeader](#validateheader) | ||
* [.checkHeader](#checkheader) | ||
* [.applyPlugins](#applyplugins) | ||
* [.plugins](#plugins) | ||
* [.mappers](#mappers) | ||
* [.parseCommit](#parsecommit) | ||
* [.stringifyCommit](#stringifycommit) | ||
* [.validateCommit](#validatecommit) | ||
* [.checkCommit](#checkcommit) | ||
* [.parse](#parse) | ||
* [.stringify](#stringify) | ||
* [.validate](#validate) | ||
* [.check](#check) | ||
* [incrementPlugin](#incrementplugin) | ||
- [Contributing](#contributing) | ||
- [Guides and Community](#guides-and-community) | ||
- [Support the project](#support-the-project) | ||
* [Guides and Community](#guides-and-community) | ||
* [Support the project](#support-the-project) | ||
- [Contributors](#contributors) | ||
- [License](#license) | ||
_(TOC generated by [verb](https://github.com/verbose/verb) using | ||
[markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ | ||
_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ | ||
## Install | ||
This project requires [**Node.js**](https://nodejs.org) **>=10.13.0** _(see | ||
This project requires [**Node.js**](https://nodejs.org) **>=10.13.0** | ||
_(see | ||
[Support & Release Policy](https://github.com/tunnckoCoreLabs/support-release-policy))_. | ||
@@ -103,2 +105,4 @@ Install it using [**yarn**](https://yarnpkg.com) or | ||
## API | ||
<!-- docks-start --> | ||
@@ -111,9 +115,8 @@ | ||
A plugin that adds `isBreakingChange` and `isBreaking` (_deprecated_) properties | ||
to the `commit`. It is already included in the `plugins` named export, and in | ||
`mappers` named export. Be aware that there's a difference between the utility | ||
`isBreakingChange` which has named export (as everything from `src/utils`) and | ||
this plugin function. | ||
to the `commit`. It is already included in the `plugins` named export, | ||
and in `mappers` named export. Be aware that there's a difference between | ||
the utility `isBreakingChange` which has named export (as everything from `src/utils`) | ||
and this plugin function. | ||
**Note: This plugin was included in v4 release version, previously was part of | ||
the `increment` plugin.** | ||
**Note: This plugin was included in v4 release version, previously was part of the `increment` plugin.** | ||
@@ -133,11 +136,8 @@ <span id="isbreakingchangeplugin-signature"></span> | ||
- `commit` **{Commit}** - a standard `Commit` object | ||
- `options` **{object}** - options to control the header regex and case | ||
sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or | ||
instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, | ||
defaults to `false` | ||
- `options` **{object}** - options to control the header regex and case sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, defaults to `false` | ||
- `returns` **{Commit}** - plus `{ isBreakingChange: boolean }` | ||
_See the [.plugins](#plugins) and [.mappers](#mappers) examples._ | ||
_See the [.plugins](#plugins) and [.mappers](#mappers) examples._ | ||
@@ -159,6 +159,7 @@ <span id="isbreakingchangeplugin-examples"></span> | ||
A plugin that adds `mentions` array property to the `commit`. It is already | ||
included in the `plugins` named export, and in `mappers` named export. Basically | ||
each entry in that array is an object, directly returned from the | ||
[collect-mentions][]. | ||
A plugin that adds `mentions` array property to the `commit`. | ||
It is already included in the `plugins` named export, | ||
and in `mappers` named export. | ||
Basically each entry in that array is an object, | ||
directly returned from the [collect-mentions][]. | ||
@@ -178,11 +179,8 @@ <span id="mentionsplugin-signature"></span> | ||
- `commit` **{Commit}** - a standard `Commit` object | ||
- `options` **{object}** - options to control the header regex and case | ||
sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or | ||
instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, | ||
defaults to `false` | ||
- `options` **{object}** - options to control the header regex and case sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, defaults to `false` | ||
- `returns` **{Commit}** - plus `{ mentions: Array<Mention> }` | ||
_See the [.plugins](#plugins) and [.mappers](#mappers) examples._ | ||
_See the [.plugins](#plugins) and [.mappers](#mappers) examples._ | ||
@@ -204,5 +202,5 @@ <span id="mentionsplugin-examples"></span> | ||
Parses given `header` string into an header object. Basically the same as | ||
[.parse](#parse), except that it only can accept single string and returns a | ||
`Header` object. | ||
Parses given `header` string into an header object. | ||
Basically the same as [.parse](#parse), except that | ||
it only can accept single string and returns a `Header` object. | ||
@@ -222,13 +220,10 @@ <span id="parseheader-signature"></span> | ||
- `header` **{string}** - a header stirng like `'fix(foo): bar baz'` | ||
- `options` **{object}** - options to control the header regex and case | ||
sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or | ||
instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, | ||
defaults to `false` | ||
- `options` **{object}** - options to control the header regex and case sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, defaults to `false` | ||
- `returns` **{Header}** - a `Header` object like `{ type, scope?, subject }` | ||
_The `parse*` methods are not doing any checking and validation, so you may want | ||
to pass the result to `validateHeader` or `checkHeader`, or to `validateHeader` | ||
with `ret` option set to `true`._ | ||
_The `parse*` methods are not doing any checking and validation, | ||
so you may want to pass the result to `validateHeader` or `checkHeader`, | ||
or to `validateHeader` with `ret` option set to `true`._ | ||
@@ -253,6 +248,6 @@ <span id="parseheader-examples"></span> | ||
Receives a `header` object, validates it using `validateHeader`, builds a | ||
"header" string and returns it. Method throws if problems found. Basically the | ||
same as [.stringify](#stringify), except that it only can accept single `Header` | ||
object. | ||
Receives a `header` object, validates it using `validateHeader`, | ||
builds a "header" string and returns it. Method throws if problems found. | ||
Basically the same as [.stringify](#stringify), except that | ||
it only can accept single `Header` object. | ||
@@ -272,8 +267,5 @@ <span id="stringifyheader-signature"></span> | ||
- `header` **{Header}** - a `Header` object like `{ type, scope?, subject }` | ||
- `options` **{object}** - options to control the header regex and case | ||
sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or | ||
instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, | ||
defaults to `false` | ||
- `options` **{object}** - options to control the header regex and case sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, defaults to `false` | ||
- `returns` **{string}** - a header stirng like `'fix(foo): bar baz'` | ||
@@ -294,5 +286,6 @@ | ||
Validates given `header` object and returns `boolean`. You may want to pass | ||
`ret` to return an object instead of throwing. Basically the same as | ||
[.validate](#validate), except that it only can accept single `Header` object. | ||
Validates given `header` object and returns `boolean`. | ||
You may want to pass `ret` to return an object instead of throwing. | ||
Basically the same as [.validate](#validate), except that | ||
it only can accept single `Header` object. | ||
@@ -312,10 +305,6 @@ <span id="validateheader-signature"></span> | ||
- `header` **{Header}** - a `Header` object like `{ type, scope?, subject }` | ||
- `options` **{object}** - options to control the header regex and case | ||
sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or | ||
instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, | ||
defaults to `false` | ||
- `returns` **{CommitResult}** - an object like | ||
`{ value: Array<Commit>, error: Error }` | ||
- `options` **{object}** - options to control the header regex and case sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, defaults to `false` | ||
- `returns` **{CommitResult}** - an object like `{ value: Array<Commit>, error: Error }` | ||
@@ -342,8 +331,5 @@ <span id="validateheader-examples"></span> | ||
const { error } = validateHeader( | ||
{ | ||
type: 'bar', | ||
}, | ||
true, | ||
); | ||
const { error } = validateHeader({ | ||
type: 'bar' | ||
}, true); | ||
@@ -356,4 +342,5 @@ console.log(error); | ||
Receives a `Header` and checks if it is valid. Basically the same as | ||
[.check](#check), except that it only can accept single `Header` object. | ||
Receives a `Header` and checks if it is valid. | ||
Basically the same as [.check](#check), except that | ||
it only can accept single `Header` object. | ||
@@ -373,10 +360,6 @@ <span id="checkheader-signature"></span> | ||
- `header` **{Header}** - a `Header` object like `{ type, scope?, subject }` | ||
- `options` **{object}** - options to control the header regex and case | ||
sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or | ||
instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, | ||
defaults to `false` | ||
- `returns` **{Header}** - returns the same as given if no problems, otherwise | ||
it will throw. | ||
- `options` **{object}** - options to control the header regex and case sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, defaults to `false` | ||
- `returns` **{Header}** - returns the same as given if no problems, otherwise it will throw. | ||
@@ -392,3 +375,3 @@ <span id="checkheader-examples"></span> | ||
checkHeader({ type: 'fix' }); | ||
} catch (err) { | ||
} catch(err) { | ||
console.log(err); | ||
@@ -409,5 +392,6 @@ // => TypeError: header.subject should be non empty string | ||
Apply a set of `plugins` over all of the given `commits`. A plugin is a simple | ||
function passed with `Commit` object, which may be returned to modify and set | ||
additional properties to the `Commit` object. | ||
Apply a set of `plugins` over all of the given `commits`. | ||
A plugin is a simple function passed with `Commit` object, | ||
which may be returned to modify and set additional properties | ||
to the `Commit` object. | ||
@@ -427,15 +411,10 @@ <span id="applyplugins-signature"></span> | ||
- `plugins` **{Plugins}** - a simple function like `(commit) => {}` | ||
- `commits` **{PossibleCommit}** - a PossibleCommit or an array of strings; a | ||
value which should already be gone through `parse` | ||
- `options` **{object}** - options to control the header regex and case | ||
sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or | ||
instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, | ||
defaults to `false` | ||
- `returns` **{Array<Commit>}** - plus the modified or added properties | ||
from each function in `plugins` | ||
- `commits` **{PossibleCommit}** - a PossibleCommit or an array of strings; a value which should already be gone through `parse` | ||
- `options` **{object}** - options to control the header regex and case sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, defaults to `false` | ||
- `returns` **{Array<Commit>}** - plus the modified or added properties from each function in `plugins` | ||
_The `commits` should be coming from `parse`, `validate` (with `ret` option) or | ||
the `check` methods. It does not do checking and validation._ | ||
_The `commits` should be coming from `parse`, `validate` (with `ret` option) | ||
or the `check` methods. It does not do checking and validation._ | ||
@@ -501,4 +480,4 @@ <span id="applyplugins-examples"></span> | ||
An array which includes `mentions`, `isBreakingChange` and `increment` built-in | ||
plugins. The `mentions` is an array of objects - basically what's returned from | ||
An array which includes `mentions`, `isBreakingChange` and `increment` built-in plugins. | ||
The `mentions` is an array of objects - basically what's returned from | ||
the [collect-mentions][] package. | ||
@@ -560,4 +539,3 @@ | ||
An object (named set) which includes `mentions` and `increment` built-in | ||
plugins. | ||
An object (named set) which includes `mentions` and `increment` built-in plugins. | ||
@@ -585,3 +563,3 @@ <span id="mappers-examples"></span> | ||
const commit = applyPlugins([mappers.increment], parsed); | ||
console.log(commit); | ||
console.log(commit) | ||
// => [{ | ||
@@ -600,4 +578,5 @@ // header: { type: 'feat', scope: 'cli', subject: 'awesome feature' }, | ||
Receives a full commit message `string` and parses it into an `Commit` object | ||
and returns it. Basically the same as [.parse](#parse), except that it only can | ||
accept single string. | ||
and returns it. | ||
Basically the same as [.parse](#parse), except that | ||
it only can accept single string. | ||
@@ -616,16 +595,11 @@ <span id="parsecommit-signature"></span> | ||
- `commit` **{string}** - a message like | ||
`'fix(foo): bar baz\n\nSome awesome body!'` | ||
- `options` **{object}** - options to control the header regex and case | ||
sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or | ||
instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, | ||
defaults to `false` | ||
- `returns` **{Commit}** - a standard object like | ||
`{ header: Header, body?, footer? }` | ||
- `commit` **{string}** - a message like `'fix(foo): bar baz\n\nSome awesome body!'` | ||
- `options` **{object}** - options to control the header regex and case sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, defaults to `false` | ||
- `returns` **{Commit}** - a standard object like `{ header: Header, body?, footer? }` | ||
_The `parse*` methods are not doing any checking and validation, so you may want | ||
to pass the result to `validateCommit` or `checkCommit`, or to `validateCommit` | ||
with `ret` option set to `true`._ | ||
_The `parse*` methods are not doing any checking and validation, | ||
so you may want to pass the result to `validateCommit` or `checkCommit`, | ||
or to `validateCommit` with `ret` option set to `true`._ | ||
@@ -650,6 +624,6 @@ <span id="parsecommit-examples"></span> | ||
Receives a `Commit` object, validates it using `validateCommit`, builds a | ||
"commit" string and returns it. Method throws if problems found. Basically the | ||
same as [.stringify](#stringify), except that it only can accept single `Commit` | ||
object. | ||
Receives a `Commit` object, validates it using `validateCommit`, | ||
builds a "commit" string and returns it. Method throws if problems found. | ||
Basically the same as [.stringify](#stringify), except that | ||
it only can accept single `Commit` object. | ||
@@ -668,10 +642,6 @@ <span id="stringifycommit-signature"></span> | ||
- `commit` **{Commit}** - a `Commit` object like | ||
`{ header: Header, body?, footer? }` | ||
- `options` **{object}** - options to control the header regex and case | ||
sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or | ||
instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, | ||
defaults to `false` | ||
- `commit` **{Commit}** - a `Commit` object like `{ header: Header, body?, footer? }` | ||
- `options` **{object}** - options to control the header regex and case sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, defaults to `false` | ||
- `returns` **{string}** - a commit nessage stirng like `'fix(foo): bar baz'` | ||
@@ -695,5 +665,5 @@ | ||
Validates given `Commit` object and returns `CommitResult`. Basically the same | ||
as [.validate](#validate), except that it only can accept single `Commit` | ||
object. | ||
Validates given `Commit` object and returns `CommitResult`. | ||
Basically the same as [.validate](#validate), except that | ||
it only can accept single `Commit` object. | ||
@@ -713,10 +683,6 @@ <span id="validatecommit-signature"></span> | ||
- `commit` **{Commit}** - a `Commit` like `{ header: Header, body?, footer? }` | ||
- `options` **{object}** - options to control the header regex and case | ||
sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or | ||
instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, | ||
defaults to `false` | ||
- `returns` **{CommitResult}** - an object like | ||
`{ value: Array<Commit>, error: Error }` | ||
- `options` **{object}** - options to control the header regex and case sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, defaults to `false` | ||
- `returns` **{CommitResult}** - an object like `{ value: Array<Commit>, error: Error }` | ||
@@ -750,4 +716,4 @@ <span id="validatecommit-examples"></span> | ||
Receives a `Commit` and checks if it is valid. Method throws if problems found. | ||
Basically the same as [.check](#check), except that it only can accept single | ||
`Commit` object. | ||
Basically the same as [.check](#check), except that | ||
it only can accept single `Commit` object. | ||
@@ -767,10 +733,6 @@ <span id="checkcommit-signature"></span> | ||
- `commit` **{Commit}** - a `Commit` like `{ header: Header, body?, footer? }` | ||
- `options` **{object}** - options to control the header regex and case | ||
sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or | ||
instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, | ||
defaults to `false` | ||
- `returns` **{Commit}** - returns the same as given if no problems, otherwise | ||
it will throw. | ||
- `options` **{object}** - options to control the header regex and case sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, defaults to `false` | ||
- `returns` **{Commit}** - returns the same as given if no problems, otherwise it will throw. | ||
@@ -786,3 +748,3 @@ <span id="checkcommit-examples"></span> | ||
checkCommit({ header: { type: 'fix' } }); | ||
} catch (err) { | ||
} catch(err) { | ||
console.log(err); | ||
@@ -817,10 +779,6 @@ // => TypeError: header.subject should be non empty string | ||
- `commits` **{PossibleCommit}** - a value to be parsed into an object like | ||
`Commit` type | ||
- `options` **{object}** - options to control the header regex and case | ||
sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or | ||
instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, | ||
defaults to `false` | ||
- `commits` **{PossibleCommit}** - a value to be parsed into an object like `Commit` type | ||
- `options` **{object}** - options to control the header regex and case sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, defaults to `false` | ||
- `returns` **{Array<Commit>}** - if array of commit objects | ||
@@ -835,3 +793,6 @@ | ||
const commits = ['fix(ci): tweaks for @circleci config', 'chore: bar qux']; | ||
const commits = [ | ||
'fix(ci): tweaks for @circleci config', | ||
'chore: bar qux' | ||
]; | ||
const result = parse(commits); | ||
@@ -868,4 +829,4 @@ console.log(result); | ||
Receives a `Commit` object, validates it using `validate`, builds a "commit" | ||
message string and returns it. | ||
Receives a `Commit` object, validates it using `validate`, | ||
builds a "commit" message string and returns it. | ||
@@ -884,15 +845,11 @@ <span id="stringify-signature"></span> | ||
- `commits` **{PossibleCommit}** - a `Commit` object, or anything that can be | ||
passed to `check` | ||
- `options` **{object}** - options to control the header regex and case | ||
sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or | ||
instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, | ||
defaults to `false` | ||
- `returns` **{Array<string>}** - an array of commit strings like | ||
`'fix(foo): bar baz'` | ||
- `commits` **{PossibleCommit}** - a `Commit` object, or anything that can be passed to `check` | ||
- `options` **{object}** - options to control the header regex and case sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, defaults to `false` | ||
- `returns` **{Array<string>}** - an array of commit strings like `'fix(foo): bar baz'` | ||
This method does checking and validation too, so if you pass a string, it will | ||
be parsed and validated, and after that turned again to string. | ||
This method does checking and validation too, | ||
so if you pass a string, it will be parsed and validated, | ||
and after that turned again to string. | ||
@@ -923,4 +880,4 @@ <span id="stringify-examples"></span> | ||
Validates a single or multiple commit message(s) in form of string, object, | ||
array of strings, array of objects or mixed. | ||
Validates a single or multiple commit message(s) in form of string, | ||
object, array of strings, array of objects or mixed. | ||
@@ -939,12 +896,7 @@ <span id="validate-signature"></span> | ||
- `commits` **{PossibleCommit}** - a value to be parsed & validated into an | ||
object like `Commit` type | ||
- `options` **{object}** - options to control the header regex and case | ||
sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or | ||
instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, | ||
defaults to `false` | ||
- `returns` **{CommitResult}** - an object like | ||
`{ value: Array<Commit>, error: Error }` | ||
- `commits` **{PossibleCommit}** - a value to be parsed & validated into an object like `Commit` type | ||
- `options` **{object}** - options to control the header regex and case sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, defaults to `false` | ||
- `returns` **{CommitResult}** - an object like `{ value: Array<Commit>, error: Error }` | ||
@@ -1006,5 +958,5 @@ <span id="validate-examples"></span> | ||
Receives a single or multiple commit message(s) in form of string, object, array | ||
of strings, array of objects or mixed. Throws if find some error. Think of it as | ||
"assert", it's basically that. | ||
Receives a single or multiple commit message(s) in form of string, | ||
object, array of strings, array of objects or mixed. | ||
Throws if find some error. Think of it as "assert", it's basically that. | ||
@@ -1023,12 +975,7 @@ <span id="check-signature"></span> | ||
- `commits` **{PossibleCommit}** - a value to be parsed & validated into an | ||
object like `Commit` type | ||
- `options` **{object}** - options to control the header regex and case | ||
sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or | ||
instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, | ||
defaults to `false` | ||
- `returns` **{Array<Commit>}** - returns the same as given if no | ||
problems, otherwise it will throw; | ||
- `commits` **{PossibleCommit}** - a value to be parsed & validated into an object like `Commit` type | ||
- `options` **{object}** - options to control the header regex and case sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, defaults to `false` | ||
- `returns` **{Array<Commit>}** - returns the same as given if no problems, otherwise it will throw; | ||
@@ -1044,3 +991,3 @@ <span id="check-examples"></span> | ||
check({ header: { type: 'fix' } }); | ||
} catch (err) { | ||
} catch(err) { | ||
console.log(err); | ||
@@ -1053,4 +1000,4 @@ // => TypeError: header.subject should be non empty string | ||
try { | ||
check('fix(): invalid scope, it cannot be empty'); | ||
} catch (err) { | ||
check('fix(): invalid scope, it cannot be empty') | ||
} catch(err) { | ||
console.log(err); | ||
@@ -1065,7 +1012,7 @@ // => TypeError: header.scope should be non empty string when given | ||
A plugin that adds `increment` property to the `commit`. It is already included | ||
in the `plugins` named export, and in `mappers` named export. | ||
A plugin that adds `increment` property to the `commit`. | ||
It is already included in the `plugins` named export, | ||
and in `mappers` named export. | ||
**Note: Since v4 this plugin doesn't add `isBreaking` property, use the | ||
`isBreaking` plugin instead.** | ||
**Note: Since v4 this plugin doesn't add `isBreaking` property, use the `isBreaking` plugin instead.** | ||
@@ -1085,11 +1032,8 @@ <span id="incrementplugin-signature"></span> | ||
- `commit` **{Commit}** - a standard `Commit` object | ||
- `options` **{object}** - options to control the header regex and case | ||
sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or | ||
instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, | ||
defaults to `false` | ||
- `options` **{object}** - options to control the header regex and case sensitivity | ||
- `options.headerRegex` **{RegExp|string}** - string regular expression or instance of RegExp | ||
- `options.caseSensitive` **{boolean}** - whether or not to be case sensitive, defaults to `false` | ||
- `returns` **{Commit}** - plus `{ increment: string }` | ||
_See the [.plugins](#plugins) and [.mappers](#mappers) examples._ | ||
_See the [.plugins](#plugins) and [.mappers](#mappers) examples._ | ||
@@ -1132,4 +1076,3 @@ <span id="incrementplugin-examples"></span> | ||
file. It's also rendered on package's page in [npmjs.com][npmv-url] and | ||
[yarnpkg.com](https://yarnpkg.com/en/package/parse-commit-message) sites too! | ||
:rocket: | ||
[yarnpkg.com](https://yarnpkg.com/en/package/parse-commit-message) sites too! :rocket: | ||
@@ -1170,5 +1113,6 @@ Not financial support? Okey! | ||
Copyright (c) 2018-present, [Charlike Mike Reagent](https://tunnckocore.com) | ||
`<opensource@tunnckocore.com>` & [contributors](#wonderful-contributors).<br> | ||
Released under the [MPL-2.0 License][license-url]. | ||
Copyright (c) 2018-present, | ||
[Charlike Mike Reagent](https://tunnckocore.com) `<opensource@tunnckocore.com>` | ||
& [contributors](#wonderful-contributors).<br> Released under the | ||
[MPL-2.0 License][license-url]. | ||
@@ -1276,2 +1220,2 @@ <!-- badges --> | ||
[parse-github-url]: https://github.com/jonschlinkert/parse-github-url | ||
[tiny-glob]: https://github.com/terkelg/tiny-glob | ||
[tiny-glob]: https://github.com/terkelg/tiny-glob |
140832
0.27%1176
-4.62%