mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-15 01:56:18 +08:00
added regex escaping function
This commit is contained in:
parent
6748f30b15
commit
70d0639fc7
1 changed files with 4 additions and 0 deletions
|
@ -2,6 +2,10 @@ export function roundTo2(num) {
|
|||
return Math.round((num + Number.EPSILON) * 100) / 100;
|
||||
}
|
||||
|
||||
export function escapeRegExp(str) {
|
||||
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
||||
}
|
||||
|
||||
export function stdDev(array) {
|
||||
const n = array.length;
|
||||
const mean = array.reduce((a, b) => a + b) / n;
|
||||
|
|
Loading…
Add table
Reference in a new issue