Security upgrades
This commit is contained in:
45
node_modules/@material-ui/system/esm/compose.js
generated
vendored
Normal file
45
node_modules/@material-ui/system/esm/compose.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
import _extends from "@babel/runtime/helpers/esm/extends";
|
||||
import merge from './merge';
|
||||
|
||||
function compose() {
|
||||
for (var _len = arguments.length, styles = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
styles[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
var fn = function fn(props) {
|
||||
return styles.reduce(function (acc, style) {
|
||||
var output = style(props);
|
||||
|
||||
if (output) {
|
||||
return merge(acc, output);
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
}; // Alternative approach that doesn't yield any performance gain.
|
||||
// const handlers = styles.reduce((acc, style) => {
|
||||
// style.filterProps.forEach(prop => {
|
||||
// acc[prop] = style;
|
||||
// });
|
||||
// return acc;
|
||||
// }, {});
|
||||
// const fn = props => {
|
||||
// return Object.keys(props).reduce((acc, prop) => {
|
||||
// if (handlers[prop]) {
|
||||
// return merge(acc, handlers[prop](props));
|
||||
// }
|
||||
// return acc;
|
||||
// }, {});
|
||||
// };
|
||||
|
||||
|
||||
fn.propTypes = process.env.NODE_ENV !== 'production' ? styles.reduce(function (acc, style) {
|
||||
return _extends(acc, style.propTypes);
|
||||
}, {}) : {};
|
||||
fn.filterProps = styles.reduce(function (acc, style) {
|
||||
return acc.concat(style.filterProps);
|
||||
}, []);
|
||||
return fn;
|
||||
}
|
||||
|
||||
export default compose;
|
||||
Reference in New Issue
Block a user