You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							167 lines
						
					
					
						
							4.3 KiB
						
					
					
				
			
		
		
	
	
							167 lines
						
					
					
						
							4.3 KiB
						
					
					
				/**
 | 
						|
 * lodash (Custom Build) <https://lodash.com/>
 | 
						|
 * Build: `lodash modularize exports="npm" -o ./`
 | 
						|
 * Copyright jQuery Foundation and other contributors <https://jquery.org/>
 | 
						|
 * Released under MIT license <https://lodash.com/license>
 | 
						|
 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
 | 
						|
 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
 | 
						|
 */
 | 
						|
 | 
						|
/** Used as references for various `Number` constants. */
 | 
						|
var INFINITY = 1 / 0;
 | 
						|
 | 
						|
/** `Object#toString` result references. */
 | 
						|
var symbolTag = '[object Symbol]';
 | 
						|
 | 
						|
/**
 | 
						|
 * Used to match `RegExp`
 | 
						|
 * [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns).
 | 
						|
 */
 | 
						|
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
 | 
						|
    reHasRegExpChar = RegExp(reRegExpChar.source);
 | 
						|
 | 
						|
/** Detect free variable `global` from Node.js. */
 | 
						|
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
 | 
						|
 | 
						|
/** Detect free variable `self`. */
 | 
						|
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
 | 
						|
 | 
						|
/** Used as a reference to the global object. */
 | 
						|
var root = freeGlobal || freeSelf || Function('return this')();
 | 
						|
 | 
						|
/** Used for built-in method references. */
 | 
						|
var objectProto = Object.prototype;
 | 
						|
 | 
						|
/**
 | 
						|
 * Used to resolve the
 | 
						|
 * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
 | 
						|
 * of values.
 | 
						|
 */
 | 
						|
var objectToString = objectProto.toString;
 | 
						|
 | 
						|
/** Built-in value references. */
 | 
						|
var Symbol = root.Symbol;
 | 
						|
 | 
						|
/** Used to convert symbols to primitives and strings. */
 | 
						|
var symbolProto = Symbol ? Symbol.prototype : undefined,
 | 
						|
    symbolToString = symbolProto ? symbolProto.toString : undefined;
 | 
						|
 | 
						|
/**
 | 
						|
 * The base implementation of `_.toString` which doesn't convert nullish
 | 
						|
 * values to empty strings.
 | 
						|
 *
 | 
						|
 * @private
 | 
						|
 * @param {*} value The value to process.
 | 
						|
 * @returns {string} Returns the string.
 | 
						|
 */
 | 
						|
function baseToString(value) {
 | 
						|
  // Exit early for strings to avoid a performance hit in some environments.
 | 
						|
  if (typeof value == 'string') {
 | 
						|
    return value;
 | 
						|
  }
 | 
						|
  if (isSymbol(value)) {
 | 
						|
    return symbolToString ? symbolToString.call(value) : '';
 | 
						|
  }
 | 
						|
  var result = (value + '');
 | 
						|
  return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Checks if `value` is object-like. A value is object-like if it's not `null`
 | 
						|
 * and has a `typeof` result of "object".
 | 
						|
 *
 | 
						|
 * @static
 | 
						|
 * @memberOf _
 | 
						|
 * @since 4.0.0
 | 
						|
 * @category Lang
 | 
						|
 * @param {*} value The value to check.
 | 
						|
 * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
 | 
						|
 * @example
 | 
						|
 *
 | 
						|
 * _.isObjectLike({});
 | 
						|
 * // => true
 | 
						|
 *
 | 
						|
 * _.isObjectLike([1, 2, 3]);
 | 
						|
 * // => true
 | 
						|
 *
 | 
						|
 * _.isObjectLike(_.noop);
 | 
						|
 * // => false
 | 
						|
 *
 | 
						|
 * _.isObjectLike(null);
 | 
						|
 * // => false
 | 
						|
 */
 | 
						|
function isObjectLike(value) {
 | 
						|
  return !!value && typeof value == 'object';
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Checks if `value` is classified as a `Symbol` primitive or object.
 | 
						|
 *
 | 
						|
 * @static
 | 
						|
 * @memberOf _
 | 
						|
 * @since 4.0.0
 | 
						|
 * @category Lang
 | 
						|
 * @param {*} value The value to check.
 | 
						|
 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
 | 
						|
 * @example
 | 
						|
 *
 | 
						|
 * _.isSymbol(Symbol.iterator);
 | 
						|
 * // => true
 | 
						|
 *
 | 
						|
 * _.isSymbol('abc');
 | 
						|
 * // => false
 | 
						|
 */
 | 
						|
function isSymbol(value) {
 | 
						|
  return typeof value == 'symbol' ||
 | 
						|
    (isObjectLike(value) && objectToString.call(value) == symbolTag);
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Converts `value` to a string. An empty string is returned for `null`
 | 
						|
 * and `undefined` values. The sign of `-0` is preserved.
 | 
						|
 *
 | 
						|
 * @static
 | 
						|
 * @memberOf _
 | 
						|
 * @since 4.0.0
 | 
						|
 * @category Lang
 | 
						|
 * @param {*} value The value to process.
 | 
						|
 * @returns {string} Returns the string.
 | 
						|
 * @example
 | 
						|
 *
 | 
						|
 * _.toString(null);
 | 
						|
 * // => ''
 | 
						|
 *
 | 
						|
 * _.toString(-0);
 | 
						|
 * // => '-0'
 | 
						|
 *
 | 
						|
 * _.toString([1, 2, 3]);
 | 
						|
 * // => '1,2,3'
 | 
						|
 */
 | 
						|
function toString(value) {
 | 
						|
  return value == null ? '' : baseToString(value);
 | 
						|
}
 | 
						|
 | 
						|
/**
 | 
						|
 * Escapes the `RegExp` special characters "^", "$", "\", ".", "*", "+",
 | 
						|
 * "?", "(", ")", "[", "]", "{", "}", and "|" in `string`.
 | 
						|
 *
 | 
						|
 * @static
 | 
						|
 * @memberOf _
 | 
						|
 * @since 3.0.0
 | 
						|
 * @category String
 | 
						|
 * @param {string} [string=''] The string to escape.
 | 
						|
 * @returns {string} Returns the escaped string.
 | 
						|
 * @example
 | 
						|
 *
 | 
						|
 * _.escapeRegExp('[lodash](https://lodash.com/)');
 | 
						|
 * // => '\[lodash\]\(https://lodash\.com/\)'
 | 
						|
 */
 | 
						|
function escapeRegExp(string) {
 | 
						|
  string = toString(string);
 | 
						|
  return (string && reHasRegExpChar.test(string))
 | 
						|
    ? string.replace(reRegExpChar, '\\$&')
 | 
						|
    : string;
 | 
						|
}
 | 
						|
 | 
						|
module.exports = escapeRegExp;
 |