lib/views.js
function (prop, pattern, options) {
    options = options || {};
    var views = this.items;
    var res = Object.create(this);

    var matcher = pattern ? lazy.mm.isMatch(pattern, options) : null;
    for (var key in views) {
       if (views.hasOwnProperty(key)) {
        var file = views[key];
        if (prop === 'key') {
          if (matcher) {
            if (matcher(path.relative(process.cwd(), key))) {
              res[key] = file;
            }
          } else {
            res[key] = file;
          }
        } else {
          var val = lazy.get(file, prop);
          if (prop === 'path' || prop === 'cwd') {
            val = path.relative(process.cwd(), val);
          }

          if (lazy.has(val)) {
            if (matcher) {
              if (matcher(val)) {
                res[key] = file;
              }
            } else {
              res[key] = file;
            }
          }
        }
      }
    }
    return res;
  }
function (prop, pattern, options) {
    options = options || {};
    var views = this.items;
    var res = Object.create(this);

    var matcher = pattern ? lazy.mm.isMatch(pattern, options) : null;
    for (var key in views) {
       if (views.hasOwnProperty(key)) {
        var file = views[key];
        if (prop === 'key') {
          if (matcher) {
            if (matcher(path.relative(process.cwd(), key))) {
              res[key] = file;
            }
          } else {
            res[key] = file;
          }
        } else {
          var val = lazy.get(file, prop);
          if (prop === 'path' || prop === 'cwd') {
            val = path.relative(process.cwd(), val);
          }

          if (lazy.has(val)) {
            if (matcher) {
              if (matcher(val)) {
                res[key] = file;
              }
            } else {
              res[key] = file;
            }
          }
        }
      }
    }
    return res;
  }
function ( prop , pattern , options ) { options = options || { } ; var views = this . items ; var res = Object . create ( this ) ; var matcher = pattern ? lazy . mm . isMatch ( pattern , options ) : null ; for ( var key in views ) { if ( views . hasOwnProperty ( key ) ) { var file = views [ key ] ; if ( prop === 'key' ) { if ( matcher ) { if ( matcher ( path . relative ( process . cwd ( ) , key ) ) ) { res [ key ] = file ; } } else { res [ key ] = file ; } } else { var val = lazy . get ( file , prop ) ; if ( prop === 'path' || prop === 'cwd' ) { val = path . relative ( process . cwd ( ) , val ) ; } if ( lazy . has ( val ) ) { if ( matcher ) { if ( matcher ( val ) ) { res [ key ] = file ; } } else { res [ key ] = file ; } } } } } return res ; }
Filter views by the given `prop`, using the specified `pattern` and `options.

@param  {String} `prop` The property to sort by.
@param  {String|Object|Array|Function} `pattern` Function, glob patterns, object, array, or string pattern to use for pre-filtering views.
@param  {Object} `options`
@option  {Object} `limit` [options]
@option  {Object} `limit` [options]
@return {Object}
Filter views by the given prop using the specified pattern and options .