lib/watch.js
function Watch(patterns, ids) {
  if (typeof patterns === 'undefined') {
    throw new Error('Watch constructor requires a patterns argument');
  }
  if (typeof ids === 'undefined') {
    throw new Error('Watch constructor requires an ids argument');
  }

  patterns = Array.isArray(patterns) ? patterns : [patterns];
  ids = Array.isArray(ids) ? ids : [ids];

  /**
   * The patterns/globs to be watched
   * @member {Array}
   * @public
   */
  this.patterns = patterns;

  /**
   * Registered tasks namespace
   * @member {Object}
   * @public
   */
  this.tasks = {

    /**
     * All 'read' phase tasks associated with this watch
     * @property {Array}
     * @public
     */
    read: []

    /**
     * A single 'write' task associated with this watch
     * @property {Task}
     */
  , write: null
  };
  
  // add the initial set of tasks
  this.add(ids);
}
function Watch(patterns, ids) {
  if (typeof patterns === 'undefined') {
    throw new Error('Watch constructor requires a patterns argument');
  }
  if (typeof ids === 'undefined') {
    throw new Error('Watch constructor requires an ids argument');
  }

  patterns = Array.isArray(patterns) ? patterns : [patterns];
  ids = Array.isArray(ids) ? ids : [ids];

  /**
   * The patterns/globs to be watched
   * @member {Array}
   * @public
   */
  this.patterns = patterns;

  /**
   * Registered tasks namespace
   * @member {Object}
   * @public
   */
  this.tasks = {

    /**
     * All 'read' phase tasks associated with this watch
     * @property {Array}
     * @public
     */
    read: []

    /**
     * A single 'write' task associated with this watch
     * @property {Task}
     */
  , write: null
  };
  
  // add the initial set of tasks
  this.add(ids);
}
function Watch ( patterns , ids ) { if ( typeof patterns === 'undefined' ) { throw new Error ( 'Watch constructor requires a patterns argument' ) ; } if ( typeof ids === 'undefined' ) { throw new Error ( 'Watch constructor requires an ids argument' ) ; } patterns = Array . isArray ( patterns ) ? patterns : [ patterns ] ; ids = Array . isArray ( ids ) ? ids : [ ids ] ; /**
   * The patterns/globs to be watched
   * @member {Array}
   * @public
   */ this . patterns = patterns ; /**
   * Registered tasks namespace
   * @member {Object}
   * @public
   */ this . tasks = { /**
     * All 'read' phase tasks associated with this watch
     * @property {Array}
     * @public
     */ read : [ ] /**
     * A single 'write' task associated with this watch
     * @property {Task}
     */ , write : null } ; // add the initial set of tasks this . add ( ids ) ; }
Watch constructor, stores tasks to be run on given patterns
@constructor
@param {Array} patterns - The patterns/globs of this instance
@param {Array} ids - Array of tasks identifiers to be run on these patterns
Watch constructor stores tasks to be run on given patterns