adwaita-web
Version:
A GTK inspired toolkit designed to build awesome web apps
15 lines (14 loc) • 311 B
JavaScript
import { hasKey } from "./hasKey";
const getPropAndCastOr = (obj, prop, defaultValue) => {
let widened = defaultValue;
if (hasKey(obj, prop)) {
widened = obj[prop];
if (typeof widened === "function") {
widened = widened.bind(obj);
}
}
return widened;
};
export {
getPropAndCastOr
};