2015-03-08 23:08:43 -07:00
|
|
|
"use strict";
|
|
|
|
|
|
2015-03-15 23:39:17 -07:00
|
|
|
// Regular expression for matching common newline characters
|
2015-03-08 23:08:43 -07:00
|
|
|
module.exports.newLineRe = /\r\n|\r|\n/;
|
2015-03-15 23:39:17 -07:00
|
|
|
|
2015-07-25 22:18:30 -07:00
|
|
|
// Regular expression for matching common front matter
|
|
|
|
|
module.exports.frontMatterRe = /^---$[^]*?^---$(\r\n|\r|\n)/m;
|
|
|
|
|
|
2015-09-26 16:55:33 -07:00
|
|
|
// Regular expression for matching inline disable/enable comments
|
|
|
|
|
module.exports.inlineCommentRe =
|
|
|
|
|
/<!--\s*markdownlint-(dis|en)able((?:\s+[a-z0-9_]+)*)\s*-->/ig;
|
|
|
|
|
|
2015-03-15 23:39:17 -07:00
|
|
|
// readFile options for reading with the UTF-8 encoding
|
|
|
|
|
module.exports.utf8Encoding = { "encoding": "utf8" };
|
2015-09-26 16:55:33 -07:00
|
|
|
|
|
|
|
|
// Applies key/value pairs from src to dst, returning dst
|
|
|
|
|
function assign(dst, src) {
|
|
|
|
|
Object.keys(src).forEach(function forKey(key) {
|
|
|
|
|
dst[key] = src[key];
|
|
|
|
|
});
|
|
|
|
|
return dst;
|
|
|
|
|
}
|
|
|
|
|
module.exports.assign = assign;
|
|
|
|
|
|
|
|
|
|
// Clones the key/value pairs of obj, returning the clone
|
|
|
|
|
module.exports.clone = function clone(obj) {
|
|
|
|
|
return assign({}, obj);
|
|
|
|
|
};
|