koa-logger.js
function createNoLogCondition (nolog) {
  let regexp = null
  if (nolog) {
    if (nolog instanceof RegExp) {
      regexp = nolog
    }

    if (typeof nolog === 'string') {
      regexp = new RegExp(nolog)
    }

    if (Array.isArray(nolog)) {
      let regexpsAsStrings = nolog.map((o) => (o.source ? o.source : o))
      regexp = new RegExp(regexpsAsStrings.join('|'))
    }
  }

  return regexp
}
function createNoLogCondition (nolog) {
  let regexp = null
  if (nolog) {
    if (nolog instanceof RegExp) {
      regexp = nolog
    }

    if (typeof nolog === 'string') {
      regexp = new RegExp(nolog)
    }

    if (Array.isArray(nolog)) {
      let regexpsAsStrings = nolog.map((o) => (o.source ? o.source : o))
      regexp = new RegExp(regexpsAsStrings.join('|'))
    }
  }

  return regexp
}
function createNoLogCondition ( nolog ) { let regexp = null if ( nolog ) { if ( nolog instanceof RegExp ) { regexp = nolog } if ( typeof nolog === 'string' ) { regexp = new RegExp ( nolog ) } if ( Array . isArray ( nolog ) ) { let regexpsAsStrings = nolog . map ( ( o ) => ( o . source ? o . source : o ) ) regexp = new RegExp ( regexpsAsStrings . join ( '|' ) ) } } return regexp }
Return RegExp Object about nolog

@param  {String} nolog
@return {RegExp}
@api private

syntax
1. String
1.1 "\\.gif"
NOT LOGGING http://example.com/hoge.gif and http://example.com/hoge.gif?fuga
LOGGING http://example.com/hoge.agif
1.2 in "\\.gif|\\.jpg$"
NOT LOGGING http://example.com/hoge.gif and
http://example.com/hoge.gif?fuga and http://example.com/hoge.jpg?fuga
LOGGING http://example.com/hoge.agif,
http://example.com/hoge.ajpg and http://example.com/hoge.jpg?hoge
1.3 in "\\.(gif|jpe?g|png)$"
NOT LOGGING http://example.com/hoge.gif and http://example.com/hoge.jpeg
LOGGING http://example.com/hoge.gif?uid=2 and http://example.com/hoge.jpg?pid=3
2. RegExp
2.1 in /\.(gif|jpe?g|png)$/
SAME AS 1.3
3. Array
3.1 ["\\.jpg$", "\\.png", "\\.gif"]
SAME AS "\\.jpg|\\.png|\\.gif"
Return RegExp Object about nolog