diff options
Diffstat (limited to 'node_modules/regex-not')
-rw-r--r-- | node_modules/regex-not/LICENSE | 2 | ||||
-rw-r--r-- | node_modules/regex-not/README.md | 62 | ||||
-rw-r--r-- | node_modules/regex-not/index.js | 12 | ||||
-rw-r--r-- | node_modules/regex-not/package.json | 9 |
4 files changed, 57 insertions, 28 deletions
diff --git a/node_modules/regex-not/LICENSE b/node_modules/regex-not/LICENSE index 66ae69c71..8ee09d911 100644 --- a/node_modules/regex-not/LICENSE +++ b/node_modules/regex-not/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016 Jon Schlinkert +Copyright (c) 2016, 2018, Jon Schlinkert. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/node_modules/regex-not/README.md b/node_modules/regex-not/README.md index 84354bfd0..24d00e7de 100644 --- a/node_modules/regex-not/README.md +++ b/node_modules/regex-not/README.md @@ -1,7 +1,9 @@ -# regex-not [](https://www.npmjs.com/package/regex-not) [](https://npmjs.org/package/regex-not) [](https://travis-ci.org/jonschlinkert/regex-not) +# regex-not [](https://www.npmjs.com/package/regex-not) [](https://npmjs.org/package/regex-not) [](https://npmjs.org/package/regex-not) [](https://travis-ci.org/jonschlinkert/regex-not) > Create a javascript regular expression for matching everything except for the given string. +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + ## Install Install with [npm](https://www.npmjs.com/): @@ -27,7 +29,7 @@ not(string[, options]); ```js var not = require('regex-not'); console.log(not('foo')); -//=> /^(?:(?!^(?:foo)$).)*$/ +//=> /^(?:(?!^(?:foo)$).)+$/ ``` **Strict matching** @@ -48,7 +50,7 @@ Returns a string to allow you to create your own regex: ```js console.log(not.create('foo')); -//=> '(?:(?!^(?:foo)$).)*' +//=> '(?:(?!^(?:foo)$).)+' ``` ### Options @@ -67,45 +69,65 @@ console.log(re.test('barfoo', {contains: true})); //=> false ## About -### Related projects - -* [regex-cache](https://www.npmjs.com/package/regex-cache): Memoize the results of a call to the RegExp constructor, avoiding repetitious runtime compilation of… [more](https://github.com/jonschlinkert/regex-cache) | [homepage](https://github.com/jonschlinkert/regex-cache "Memoize the results of a call to the RegExp constructor, avoiding repetitious runtime compilation of the same string and options, resulting in suprising performance improvements.") -* [to-regex](https://www.npmjs.com/package/to-regex): Generate a regex from a string or array of strings. | [homepage](https://github.com/jonschlinkert/to-regex "Generate a regex from a string or array of strings.") - -### Contributing +<details> +<summary><strong>Contributing</strong></summary> Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). -### Building docs +</details> -_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_ +<details> +<summary><strong>Running Tests</strong></summary> -To generate the readme and API documentation with [verb](https://github.com/verbose/verb): +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: ```sh -$ npm install -g verb verb-generate-readme && verb +$ npm install && npm test ``` -### Running tests +</details> + +<details> +<summary><strong>Building docs</strong></summary> -Install dev dependencies: +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: ```sh -$ npm install -d && npm test +$ npm install -g verbose/verb#dev verb-generate-readme && verb ``` +</details> + +### Related projects + +You might also be interested in these projects: + +* [regex-cache](https://www.npmjs.com/package/regex-cache): Memoize the results of a call to the RegExp constructor, avoiding repetitious runtime compilation of… [more](https://github.com/jonschlinkert/regex-cache) | [homepage](https://github.com/jonschlinkert/regex-cache "Memoize the results of a call to the RegExp constructor, avoiding repetitious runtime compilation of the same string and options, resulting in surprising performance improvements.") +* [to-regex](https://www.npmjs.com/package/to-regex): Generate a regex from a string or array of strings. | [homepage](https://github.com/jonschlinkert/to-regex "Generate a regex from a string or array of strings.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 9 | [jonschlinkert](https://github.com/jonschlinkert) | +| 1 | [doowb](https://github.com/doowb) | +| 1 | [EdwardBetts](https://github.com/EdwardBetts) | + ### Author **Jon Schlinkert** +* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert) * [github/jonschlinkert](https://github.com/jonschlinkert) -* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) ### License -Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT license](https://github.com/jonschlinkert/regex-not/blob/master/LICENSE). +Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). *** -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.1.31, on October 07, 2016._
\ No newline at end of file +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on February 19, 2018._
\ No newline at end of file diff --git a/node_modules/regex-not/index.js b/node_modules/regex-not/index.js index 8593d8b3a..02bfed4a8 100644 --- a/node_modules/regex-not/index.js +++ b/node_modules/regex-not/index.js @@ -1,6 +1,7 @@ 'use strict'; var extend = require('extend-shallow'); +var safe = require('safe-regex'); /** * The main export is a function that takes a `pattern` string and an `options` object. @@ -41,7 +42,7 @@ toRegex.create = function(pattern, options) { } var opts = extend({}, options); - if (opts && opts.contains === true) { + if (opts.contains === true) { opts.strictNegate = false; } @@ -50,13 +51,18 @@ toRegex.create = function(pattern, options) { var endChar = opts.endChar ? opts.endChar : '+'; var str = pattern; - if (opts && opts.strictNegate === false) { + if (opts.strictNegate === false) { str = '(?:(?!(?:' + pattern + ')).)' + endChar; } else { str = '(?:(?!^(?:' + pattern + ')$).)' + endChar; } - return open + str + close; + var res = open + str + close; + if (opts.safe === true && safe(res) === false) { + throw new Error('potentially unsafe regular expression: ' + res); + } + + return res; }; /** diff --git a/node_modules/regex-not/package.json b/node_modules/regex-not/package.json index b787bf755..0320d5324 100644 --- a/node_modules/regex-not/package.json +++ b/node_modules/regex-not/package.json @@ -1,7 +1,7 @@ { "name": "regex-not", "description": "Create a javascript regular expression for matching everything except for the given string.", - "version": "1.0.0", + "version": "1.0.2", "homepage": "https://github.com/jonschlinkert/regex-not", "author": "Jon Schlinkert (https://github.com/jonschlinkert)", "repository": "jonschlinkert/regex-not", @@ -20,11 +20,12 @@ "test": "mocha" }, "dependencies": { - "extend-shallow": "^2.0.1" + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" }, "devDependencies": { - "gulp-format-md": "^0.1.10", - "mocha": "^3.0.2" + "gulp-format-md": "^1.0.0", + "mocha": "^3.5.3" }, "keywords": [ "exec", |