Skip to content

Commit

Permalink
Docs: Improve isCustomProp documentation (ref #144)
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Apr 22, 2019
1 parent 1ed02bb commit 02c8923
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Expand Up @@ -408,9 +408,12 @@ class SuperFile extends Vinyl {
return super.isCustomProp(name) && builtInProps.indexOf(name) === -1;
}
}

// `foo` won't be assigned to the object below
new SuperFile({ foo: "something" });
```

This makes properties `foo` and `_foo` ignored when cloning, and when passed in options to `constructor(options)` so they don't get assigned to the new object.
This makes properties `foo` and `_foo` skipped when passed in options to `constructor(options)` so they don't get assigned to the new object and override your custom implementation. They also won't be copied when cloning. __Note:__ The `_foo` and `foo` properties will still exist on the created/cloned object because you are assigning `_foo` in the constructor and `foo` is defined on the prototype.

Same goes for `clone()`. If you have your own internal stuff that needs special handling during cloning, you should extend it to do so.

Expand Down

0 comments on commit 02c8923

Please sign in to comment.