Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99534512
compose.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jan 25, 06:28
Size
752 B
Mime Type
text/x-java
Expires
Mon, Jan 27, 06:28 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23797356
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
compose.js
View Options
import merge from './merge';
function compose(...styles) {
const handlers = styles.reduce((acc, style) => {
style.filterProps.forEach(prop => {
acc[prop] = style;
});
return acc;
}, {});
// false positive
// eslint-disable-next-line react/function-component-definition
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((acc, style) => Object.assign(acc, style.propTypes), {}) : {};
fn.filterProps = styles.reduce((acc, style) => acc.concat(style.filterProps), []);
return fn;
}
export default compose;
Event Timeline
Log In to Comment