Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120243472
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
Wed, Jul 2, 22:09
Size
752 B
Mime Type
text/x-java
Expires
Fri, Jul 4, 22:09 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27160718
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