escape-string-regexp throws - make sure value passed in str before calling
This commit is contained in:
parent
5392313414
commit
87359b1198
1 changed files with 13 additions and 3 deletions
16
index.js
16
index.js
|
|
@ -53,7 +53,10 @@ if (isSimpleWindowsTerm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const key of Object.keys(ansiStyles)) {
|
for (const key of Object.keys(ansiStyles)) {
|
||||||
ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
|
// Module escape-string-regexp throws if value entered is not a string.
|
||||||
|
if (typeof ansiStyles[key].close === 'string') {
|
||||||
|
ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g');
|
||||||
|
}
|
||||||
|
|
||||||
styles[key] = {
|
styles[key] = {
|
||||||
get() {
|
get() {
|
||||||
|
|
@ -69,7 +72,10 @@ styles.visible = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');
|
// Module escape-string-regexp throws if value entered is not a string.
|
||||||
|
if (typeof ansiStyles.color.close === 'string') {
|
||||||
|
ansiStyles.color.closeRe = new RegExp(escapeStringRegexp(ansiStyles.color.close), 'g');
|
||||||
|
}
|
||||||
for (const model of Object.keys(ansiStyles.color.ansi)) {
|
for (const model of Object.keys(ansiStyles.color.ansi)) {
|
||||||
if (skipModels.has(model)) {
|
if (skipModels.has(model)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -91,7 +97,11 @@ for (const model of Object.keys(ansiStyles.color.ansi)) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g');
|
// Module escape-string-regexp throws if value entered is not a string.
|
||||||
|
if (typeof ansiStyles.bgColor.close === 'string') {
|
||||||
|
ansiStyles.bgColor.closeRe = new RegExp(escapeStringRegexp(ansiStyles.bgColor.close), 'g');
|
||||||
|
}
|
||||||
|
|
||||||
for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
|
for (const model of Object.keys(ansiStyles.bgColor.ansi)) {
|
||||||
if (skipModels.has(model)) {
|
if (skipModels.has(model)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue