lib/file.js
function (file) {
    this.src = file.src || {};
    if (this.path) {
      this.src.path = this.path;
    }
    if (Buffer.isBuffer(this.contents)) {
      this.content = this.contents.toString();
    }
    if (this.content) {
      this.options.orig = this.content;
    }

    // ensure that `file` has `path` and `content` properties
    this.validate(file);

    this.options.orig = file.content;
    this.options.plural = this.collection.options.plural;
    this.options.handled = this.options.handled = [];

    this.src = file.src || {};
    this.src.path = this.src.path || this.path;

    // add non-emumerable properties
    this.defineOption('route', this.options.route);
    this.define('_callbacks', this._callbacks);
    file.__proto__ = this;
    file.path = this.path;

    // handle `onLoad` middleware routes
    this.app.handle('onLoad', file);
  }
function (file) {
    this.src = file.src || {};
    if (this.path) {
      this.src.path = this.path;
    }
    if (Buffer.isBuffer(this.contents)) {
      this.content = this.contents.toString();
    }
    if (this.content) {
      this.options.orig = this.content;
    }

    // ensure that `file` has `path` and `content` properties
    this.validate(file);

    this.options.orig = file.content;
    this.options.plural = this.collection.options.plural;
    this.options.handled = this.options.handled = [];

    this.src = file.src || {};
    this.src.path = this.src.path || this.path;

    // add non-emumerable properties
    this.defineOption('route', this.options.route);
    this.define('_callbacks', this._callbacks);
    file.__proto__ = this;
    file.path = this.path;

    // handle `onLoad` middleware routes
    this.app.handle('onLoad', file);
  }
function ( file ) { this . src = file . src || { } ; if ( this . path ) { this . src . path = this . path ; } if ( Buffer . isBuffer ( this . contents ) ) { this . content = this . contents . toString ( ) ; } if ( this . content ) { this . options . orig = this . content ; } // ensure that `file` has `path` and `content` properties this . validate ( file ) ; this . options . orig = file . content ; this . options . plural = this . collection . options . plural ; this . options . handled = this . options . handled = [ ] ; this . src = file . src || { } ; this . src . path = this . src . path || this . path ; // add non-emumerable properties this . defineOption ( 'route' , this . options . route ) ; this . define ( '_callbacks' , this . _callbacks ) ; file . __proto__ = this ; file . path = this . path ; // handle `onLoad` middleware routes this . app . handle ( 'onLoad' , file ) ; }
Initialize file with base properties.
Initialize file with base properties .