保誠-保戶業務員媒合平台
HelenHuang
2022-06-09 9bdb95c9e34cef640534e5e5a1e2225a80442000
PAMapp/node_modules/ignore/index.js
@@ -30,6 +30,8 @@
const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g
const RETURN_FALSE = () => false
// Sanitize the range of a regular expression
// The cases are complicated, see test cases for details
const sanitizeRange = range => range.replace(
@@ -288,22 +290,18 @@
const regexCache = Object.create(null)
// @param {pattern}
const makeRegex = (pattern, negative, ignorecase) => {
  const r = regexCache[pattern]
  if (r) {
    return r
const makeRegex = (pattern, ignoreCase) => {
  let source = regexCache[pattern]
  if (!source) {
    source = REPLACERS.reduce(
      (prev, current) => prev.replace(current[0], current[1].bind(pattern)),
      pattern
    )
    regexCache[pattern] = source
  }
  // const replacers = negative
  //   ? NEGATIVE_REPLACERS
  //   : POSITIVE_REPLACERS
  const source = REPLACERS.reduce(
    (prev, current) => prev.replace(current[0], current[1].bind(pattern)),
    pattern
  )
  return regexCache[pattern] = ignorecase
  return ignoreCase
    ? new RegExp(source, 'i')
    : new RegExp(source)
}
@@ -334,7 +332,7 @@
  }
}
const createRule = (pattern, ignorecase) => {
const createRule = (pattern, ignoreCase) => {
  const origin = pattern
  let negative = false
@@ -352,7 +350,7 @@
  // >   begin with a hash.
  .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#')
  const regex = makeRegex(pattern, negative, ignorecase)
  const regex = makeRegex(pattern, ignoreCase)
  return new IgnoreRule(
    origin,
@@ -398,11 +396,15 @@
class Ignore {
  constructor ({
    ignorecase = true
    ignorecase = true,
    ignoreCase = ignorecase,
    allowRelativePaths = false
  } = {}) {
    this._rules = []
    this._ignorecase = ignorecase
    define(this, KEY_IGNORE, true)
    this._rules = []
    this._ignoreCase = ignoreCase
    this._allowRelativePaths = allowRelativePaths
    this._initCache()
  }
@@ -420,7 +422,7 @@
    }
    if (checkPattern(pattern)) {
      const rule = createRule(pattern, this._ignorecase)
      const rule = createRule(pattern, this._ignoreCase)
      this._added = true
      this._rules.push(rule)
    }
@@ -499,7 +501,13 @@
      // Supports nullable path
      && checkPath.convert(originalPath)
    checkPath(path, originalPath, throwError)
    checkPath(
      path,
      originalPath,
      this._allowRelativePaths
        ? RETURN_FALSE
        : throwError
    )
    return this._t(path, cache, checkUnignored, slices)
  }
@@ -557,10 +565,8 @@
const factory = options => new Ignore(options)
const returnFalse = () => false
const isPathValid = path =>
  checkPath(path && checkPath.convert(path), path, returnFalse)
  checkPath(path && checkPath.convert(path), path, RETURN_FALSE)
factory.isPathValid = isPathValid