changelog-parser: switch the callback params (#34204)

* changelog-parser: switch the callback params

* changelog-parser: stricter tests
This commit is contained in:
James Garbutt 2019-03-30 00:41:28 +00:00 committed by Ron Buckton
parent 8358bee6b8
commit 5033db6098
2 changed files with 15 additions and 6 deletions

View File

@ -5,12 +5,20 @@ const options = {
removeMarkdown: false
};
parseChangelog({filePath: 'path/to/CHANGELOG.md'}, (result, error) => {});
const fn = (obj: object): void => {};
parseChangelog(options, (result, error) => {});
parseChangelog({filePath: 'path/to/CHANGELOG.md'}, (error, result) => {
if (error) {
throw error;
}
parseChangelog({filePath: 'path/to/CHANGELOG.md'}, (result) => {});
fn(result);
});
parseChangelog(options);
parseChangelog(options, (error, result) => {});
parseChangelog('path/to/CHANGELOG.md');
parseChangelog({filePath: 'path/to/CHANGELOG.md'}, (error) => {});
parseChangelog(options).then((result) => {});
parseChangelog('path/to/CHANGELOG.md').then((result) => {});

View File

@ -19,6 +19,7 @@ interface Options {
/**
* Change log parser for node.
*/
declare function parseChangelog(options: Partial<Options>|string, callback?: (result: object, error: string|null) => void): Promise<object>;
declare function parseChangelog(options: Partial<Options>|string,
callback?: (error: string|null, result: object) => void): Promise<object>;
export = parseChangelog;