21 lines
474 B
JavaScript
21 lines
474 B
JavaScript
/**
|
|
* @author Titus Wormer
|
|
* @copyright 2015 Titus Wormer
|
|
* @license MIT
|
|
* @module mdast:toc
|
|
* @fileoverview Generate a Table of Contents (TOC) from a given Markdown file.
|
|
*/
|
|
|
|
/* Expose. */
|
|
module.exports = toExpression;
|
|
|
|
/**
|
|
* Transform a string into an applicable expression.
|
|
*
|
|
* @param {string} value - Content to expressionise.
|
|
* @return {RegExp} - Expression from `value`.
|
|
*/
|
|
function toExpression(value) {
|
|
return new RegExp('^(' + value + ')$', 'i');
|
|
}
|