Add files
This commit is contained in:
commit
bb80829159
18195 changed files with 2122994 additions and 0 deletions
58
509bba0_unpacked_with_node_modules/~/hoist-non-react-statics/index.js
generated
Executable file
58
509bba0_unpacked_with_node_modules/~/hoist-non-react-statics/index.js
generated
Executable file
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* Copyright 2015, Yahoo! Inc.
|
||||
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var REACT_STATICS = {
|
||||
childContextTypes: true,
|
||||
contextTypes: true,
|
||||
defaultProps: true,
|
||||
displayName: true,
|
||||
getDefaultProps: true,
|
||||
mixins: true,
|
||||
propTypes: true,
|
||||
type: true
|
||||
};
|
||||
|
||||
var KNOWN_STATICS = {
|
||||
name: true,
|
||||
length: true,
|
||||
prototype: true,
|
||||
caller: true,
|
||||
arguments: true,
|
||||
arity: true
|
||||
};
|
||||
|
||||
var isGetOwnPropertySymbolsAvailable = typeof Object.getOwnPropertySymbols === 'function';
|
||||
|
||||
module.exports = function hoistNonReactStatics(targetComponent, sourceComponent, customStatics) {
|
||||
if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components
|
||||
var keys = Object.getOwnPropertyNames(sourceComponent);
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (isGetOwnPropertySymbolsAvailable) {
|
||||
keys = keys.concat(Object.getOwnPropertySymbols(sourceComponent));
|
||||
}
|
||||
|
||||
for (var i = 0; i < keys.length; ++i) {
|
||||
if (!REACT_STATICS[keys[i]] && !KNOWN_STATICS[keys[i]] && (!customStatics || !customStatics[keys[i]])) {
|
||||
try {
|
||||
targetComponent[keys[i]] = sourceComponent[keys[i]];
|
||||
} catch (error) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return targetComponent;
|
||||
};
|
||||
|
||||
|
||||
|
||||
//////////////////
|
||||
// WEBPACK FOOTER
|
||||
// ./~/hoist-non-react-statics/index.js
|
||||
// module id = 474
|
||||
// module chunks = 4
|
Loading…
Add table
Add a link
Reference in a new issue