mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-07 04:26:32 +08:00
This also adds CC-BY-4.0 to the list of accepted licenses. DISABLE_THIRD_PARTY_CHECK=update dependencies Bug: chromium:1083142 Change-Id: I8612de2fba52dae32eeb71af79d5aacfde52142b Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2220097 Reviewed-by: Paul Lewis <aerotwist@chromium.org> Commit-Queue: Mathias Bynens <mathias@chromium.org>
59 lines
1.7 KiB
Markdown
59 lines
1.7 KiB
Markdown
# clone-regexp [](https://travis-ci.org/sindresorhus/clone-regexp)
|
|
|
|
> Clone and modify a [RegExp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp) instance
|
|
|
|
|
|
## Install
|
|
|
|
```
|
|
$ npm install clone-regexp
|
|
```
|
|
|
|
|
|
## Usage
|
|
|
|
```js
|
|
const cloneRegexp = require('clone-regexp');
|
|
|
|
const regex = /[a-z]/gi;
|
|
|
|
cloneRegexp(regex);
|
|
//=> /[a-z]/gi
|
|
|
|
cloneRegexp(regex) === regex;
|
|
//=> false
|
|
|
|
cloneRegexp(regex, {global: false});
|
|
//=> /[a-z]/i
|
|
|
|
cloneRegexp(regex, {multiline: true});
|
|
//=> /[a-z]/gim
|
|
|
|
cloneRegexp(regex, {source: 'unicorn'});
|
|
//=> /unicorn/gi
|
|
```
|
|
|
|
|
|
## API
|
|
|
|
### cloneRegexp(regexp, [options])
|
|
|
|
#### regex
|
|
|
|
Type: `RegExp`
|
|
|
|
Regex to clone.
|
|
|
|
|
|
#### options
|
|
|
|
Type: `Object`<br>
|
|
Properties: [`source`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/source) [`global`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/global) [`ignoreCase`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/ignoreCase) [`multiline`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/multiline) [`dotAll`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/dotAll) [`sticky`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/sticky) [`unicode`](http://norbertlindenberg.com/2012/05/ecmascript-supplementary-characters/#RegExp) [`lastIndex`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/lastIndex)
|
|
|
|
Optionally modify the cloned `RegExp` instance.
|
|
|
|
|
|
## License
|
|
|
|
MIT © [Sindre Sorhus](https://sindresorhus.com)
|