for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
export default class SmileyConf {
static getSmileys() {
return JSINFO.SMILEY_CONF;
JSINFO
/** global: JSINFO */
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.
}
/**
* Regex escape as recommended by MDN
*
* @param {string} string
* @returns {string}
*/
static escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
* Build Regex from conf
* Similar to DokuWiki parser but without lookbehind (currently supported only by Chrome)
* @see \Doku_Parser_Mode_smiley
* @returns {RegExp}
static getRegex() {
const smileyGroups = Object.keys(this.getSmileys())
.map(smiley => SmileyConf.escapeRegExp(smiley));
return new RegExp(`(?:\\W|^)(${smileyGroups.join('|')})(?=\\W|$)`);
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.