Skip to content

Commit

Permalink
Merge 007d1db into 3b8def9
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Jul 3, 2020
2 parents 3b8def9 + 007d1db commit 7fe7bb5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -6,8 +6,8 @@
[![Dependency Status](https://img.shields.io/david/mridgway/hoist-non-react-statics.svg)](https://david-dm.org/mridgway/hoist-non-react-statics)
[![devDependency Status](https://img.shields.io/david/dev/mridgway/hoist-non-react-statics.svg)](https://david-dm.org/mridgway/hoist-non-react-statics#info=devDependencies)

Copies non-react specific statics from a child component to a parent component.
Similar to `Object.assign`, but with React static keywords blacklisted from
Copies non-react specific statics from a child component to a parent component.
Similar to `Object.assign`, but with React static keywords prevented from
being overridden.

```bash
Expand Down
6 changes: 3 additions & 3 deletions src/index.js
Expand Up @@ -66,13 +66,13 @@ const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
const getPrototypeOf = Object.getPrototypeOf;
const objectPrototype = Object.prototype;

export default function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
export default function hoistNonReactStatics(targetComponent, sourceComponent, excludelist) {
if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components

if (objectPrototype) {
const inheritedComponent = getPrototypeOf(sourceComponent);
if (inheritedComponent && inheritedComponent !== objectPrototype) {
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
hoistNonReactStatics(targetComponent, inheritedComponent, excludelist);
}
}

Expand All @@ -88,7 +88,7 @@ export default function hoistNonReactStatics(targetComponent, sourceComponent, b
for (let i = 0; i < keys.length; ++i) {
const key = keys[i];
if (!KNOWN_STATICS[key] &&
!(blacklist && blacklist[key]) &&
!(excludelist && excludelist[key]) &&
!(sourceStatics && sourceStatics[key]) &&
!(targetStatics && targetStatics[key])
) {
Expand Down

0 comments on commit 7fe7bb5

Please sign in to comment.