Skip to content

Commit

Permalink
Allowing regex patterns to specify flags (chalk#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZSkycat authored Jul 6, 2018
1 parent 14839a4 commit 045bf59
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

module.exports = () => {
module.exports = (flag) => {
const pattern = [
'[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)',
'(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))'
].join('|');

return new RegExp(pattern, 'g');
return new RegExp(pattern, typeof flag === 'string' ? flag : 'g');
};

0 comments on commit 045bf59

Please sign in to comment.