jormungandr-bite/src/common/text/elements/bold.js

18 lines
301 B
JavaScript
Raw Normal View History

2016-12-28 15:49:51 -07:00
/**
* Bold
*/
const regexp = /\*\*(.+?)\*\*/;
module.exports = {
test: x => new RegExp('^' + regexp.source).test(x),
parse: text => {
const bold = text.match(new RegExp('^' + regexp.source))[0];
return {
type: 'bold',
content: bold,
bold: bold.substr(2, bold.length - 4)
};
}
};