src/watchman.js
function createRule(path, handler) {
  if ('*' !== path && 0 != path.indexOf(watch.__base)) {
    path = watch.__base + (path == '/' ? '' : path)
  }
  let rule = pathToRegExp(path)
  if (handler instanceof String) {
    let target = handler
    handler = function() {
      watch({
        url: target
      })
    }
  }
  rule.handler = handler

  return rule
}
function createRule(path, handler) {
  if ('*' !== path && 0 != path.indexOf(watch.__base)) {
    path = watch.__base + (path == '/' ? '' : path)
  }
  let rule = pathToRegExp(path)
  if (handler instanceof String) {
    let target = handler
    handler = function() {
      watch({
        url: target
      })
    }
  }
  rule.handler = handler

  return rule
}
function createRule ( path , handler ) { if ( '*' !== path && 0 != path . indexOf ( watch . __base ) ) { path = watch . __base + ( path == '/' ? '' : path ) } let rule = pathToRegExp ( path ) if ( handler instanceof String ) { let target = handler handler = function ( ) { watch ( { url : target } ) } } rule . handler = handler return rule }
create a rule
@param  {String}  path    path
@param  {Funtion} handler handle callback
@return {Object}          rule object
create a rule