Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Extending Vinyl still have build in properties #144

@juliet-zhu

Description

@juliet-zhu

Hi, in README.md [https://github.com/gulpjs/vinyl#extending-vinyl]

var Vinyl = require('vinyl');

var builtInProps = ['foo', '_foo'];

class SuperFile extends Vinyl {
  constructor(options) {
    super(options);
    this._foo = 'example internal read-only value';
  }

  get foo() {
    return this._foo;
  }

  static isCustomProp(name) {
    return super.isCustomProp(name) && builtInProps.indexOf(name) === -1;
  }
}
var superIns = new SuperFile();
var superInsCopy = superIns.clone();
console.log(superInsCopy.foo);

From my understanding, foo or _foo should not be in superIns and superInsCopy instacnes, but I still can query them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions