Skip to content

Commit

Permalink
Small performance improvement when creating the RegExp (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky authored Feb 26, 2021
1 parent 5a232db commit 709af08
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';
const ansiRegex = require('ansi-regex');

// Removes the `g` flag
const regex = new RegExp(ansiRegex().source);
const regex = ansiRegex({onlyFirst: true});

module.exports = string => regex.test(string);

0 comments on commit 709af08

Please sign in to comment.