How to use to-regex - 3 common examples

To help you get started, we’ve selected a few to-regex examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Opentrons / opentrons / discovery-client / src / index.js View on Github external
constructor(options: Options) {
    super()

    // null out ok flag for pre-populated services
    this.services = createServiceList(options.services || [])

    // allow strings instead of full {ip: string, port: ?number} object
    this.candidates = (options.candidates || [])
      .map(c => (typeof c === 'string' ? makeCandidate(c) : c))
      .filter(c => this.services.every(s => s.ip !== c.ip))

    this._browser = null
    this._pollList = []
    this._pollInterval = options.pollInterval || DEFAULT_POLL_INTERVAL
    this._pollRequest = null
    this._nameFilter = toRegex(santizeRe(options.nameFilter), TO_REGEX_OPTS)
    this._ipFilter = toRegex(santizeRe(options.ipFilter), TO_REGEX_OPTS)
    this._portFilter = [DEFAULT_PORT].concat(options.portFilter || [])
    this._logger = options.logger

    log(this._logger, 'silly', 'Created', this)
  }
github Opentrons / opentrons / discovery-client / src / index.js View on Github external
super()

    // null out ok flag for pre-populated services
    this.services = createServiceList(options.services || [])

    // allow strings instead of full {ip: string, port: ?number} object
    this.candidates = (options.candidates || [])
      .map(c => (typeof c === 'string' ? makeCandidate(c) : c))
      .filter(c => this.services.every(s => s.ip !== c.ip))

    this._browser = null
    this._pollList = []
    this._pollInterval = options.pollInterval || DEFAULT_POLL_INTERVAL
    this._pollRequest = null
    this._nameFilter = toRegex(santizeRe(options.nameFilter), TO_REGEX_OPTS)
    this._ipFilter = toRegex(santizeRe(options.ipFilter), TO_REGEX_OPTS)
    this._portFilter = [DEFAULT_PORT].concat(options.portFilter || [])
    this._logger = options.logger

    log(this._logger, 'silly', 'Created', this)
  }
github sebastian-software / preppy / src / getTasks.js View on Github external
function matches(fileName) {
    return limit ? toRegex(limit, { contains: true }).exec(fileName) : true
  }

to-regex

Generate a regex from a string or array of strings.

MIT
Latest version published 7 years ago

Package Health Score

67 / 100
Full package analysis

Popular to-regex functions