@braineet/ui
Version:
Braineet design system
18 lines (17 loc) • 565 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, text) {
return themedProperty(text, size);
});