react-google-maps-sep
Version:
React.js Google Maps integration component
21 lines (18 loc) • 622 B
JavaScript
import {default as controlledOrDefault} from "./controlledOrDefault";
export default function composeOptions (props, controlledPropTypes) {
const optionNameList = Object.keys(controlledPropTypes);
const getter = controlledOrDefault(props);
// props from arguments may contain unknow props.
// We only interested those in optionNameList
return optionNameList.reduce((acc, optionName) => {
if ("options" !== optionName) {
const value = getter(optionName);
if ("undefined" !== typeof value) {
acc[optionName] = value;
}
}
return acc;
}, {
...getter("options"),
});
}