@braineet/ui
Version:
Braineet design system
17 lines • 570 B
JavaScript
import get from 'lodash/get';
import isObject from 'lodash/isObject';
/**
* Util function for theming.
* @param {object} object - an object with theme presets.
* @param {*} keyOrValue - the key for the object, or an actual value.
* @return {*} the value of the object, or the `keyOrValue` itself.
*/
var themedProperty = function themedProperty(object, keyOrValue) {
if (object && isObject(object)) {
return get(object, keyOrValue, keyOrValue);
}
return keyOrValue;
};
export default (function (size, heading) {
return themedProperty(heading, size);
});