aboutsummaryrefslogtreecommitdiff
path: root/node_modules/regex-cache/index.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
commitcc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch)
tree92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/regex-cache/index.js
parent3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff)
remove node_modules
Diffstat (limited to 'node_modules/regex-cache/index.js')
-rw-r--r--node_modules/regex-cache/index.js68
1 files changed, 0 insertions, 68 deletions
diff --git a/node_modules/regex-cache/index.js b/node_modules/regex-cache/index.js
deleted file mode 100644
index df8c42312..000000000
--- a/node_modules/regex-cache/index.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/*!
- * regex-cache <https://github.com/jonschlinkert/regex-cache>
- *
- * Copyright (c) 2015-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
-
-'use strict';
-
-var equal = require('is-equal-shallow');
-var basic = {};
-var cache = {};
-
-/**
- * Expose `regexCache`
- */
-
-module.exports = regexCache;
-
-/**
- * Memoize the results of a call to the new RegExp constructor.
- *
- * @param {Function} fn [description]
- * @param {String} str [description]
- * @param {Options} options [description]
- * @param {Boolean} nocompare [description]
- * @return {RegExp}
- */
-
-function regexCache(fn, str, opts) {
- var key = '_default_', regex, cached;
-
- if (!str && !opts) {
- if (typeof fn !== 'function') {
- return fn;
- }
- return basic[key] || (basic[key] = fn(str));
- }
-
- var isString = typeof str === 'string';
- if (isString) {
- if (!opts) {
- return basic[str] || (basic[str] = fn(str));
- }
- key = str;
- } else {
- opts = str;
- }
-
- cached = cache[key];
- if (cached && equal(cached.opts, opts)) {
- return cached.regex;
- }
-
- memo(key, opts, (regex = fn(str, opts)));
- return regex;
-}
-
-function memo(key, opts, regex) {
- cache[key] = {regex: regex, opts: opts};
-}
-
-/**
- * Expose `cache`
- */
-
-module.exports.cache = cache;
-module.exports.basic = basic;