mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-17 14:30:12 +01:00
Handle non-Array inputs for options.files.
This commit is contained in:
parent
c4a0e6c312
commit
1e23d035ce
2 changed files with 19 additions and 1 deletions
|
|
@ -230,7 +230,12 @@ function markdownlint(options, callback) {
|
||||||
// Normalize inputs
|
// Normalize inputs
|
||||||
options = options || {};
|
options = options || {};
|
||||||
callback = callback || function noop() {};
|
callback = callback || function noop() {};
|
||||||
var files = (options.files || []).slice();
|
var files = [];
|
||||||
|
if (Array.isArray(options.files)) {
|
||||||
|
files = options.files.slice();
|
||||||
|
} else if (options.files) {
|
||||||
|
files = [ String(options.files) ];
|
||||||
|
}
|
||||||
var strings = options.strings || {};
|
var strings = options.strings || {};
|
||||||
var frontMatter = (options.frontMatter === undefined) ?
|
var frontMatter = (options.frontMatter === undefined) ?
|
||||||
shared.frontMatterRe : options.frontMatter;
|
shared.frontMatterRe : options.frontMatter;
|
||||||
|
|
|
||||||
|
|
@ -643,6 +643,19 @@ module.exports.filesArrayNotModified = function filesArrayNotModified(test) {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports.filesArrayAsString = function filesArrayAsString(test) {
|
||||||
|
test.expect(2);
|
||||||
|
markdownlint({
|
||||||
|
"files": "README.md",
|
||||||
|
"config": { "MD013": false }
|
||||||
|
}, function callback(err, actual) {
|
||||||
|
test.ifError(err);
|
||||||
|
var expected = { "README.md": {} };
|
||||||
|
test.deepEqual(actual, expected, "Unexpected issues.");
|
||||||
|
test.done();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
module.exports.missingOptions = function missingOptions(test) {
|
module.exports.missingOptions = function missingOptions(test) {
|
||||||
test.expect(2);
|
test.expect(2);
|
||||||
markdownlint(null, function callback(err, result) {
|
markdownlint(null, function callback(err, result) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue