rumble-charts
Version:
Truly declarative React charts components
28 lines (25 loc) • 936 B
JavaScript
import { __assign } from '../external/tslib/tslib.es6.js';
import { isFunction } from './isFunction.js';
import { isObject } from './isObject.js';
import { isUndefined } from './isUndefined.js';
function value(attribute, args) {
if (Array.isArray(attribute)) {
var result = void 0;
for (var _i = 0, attribute_1 = attribute; _i < attribute_1.length; _i++) {
var attr = attribute_1[_i];
attr = isFunction(attr) ? attr(args) : attr;
if (isObject(attr) && !Array.isArray(attr) && !('_owner' in attr) && !('props' in attr)) {
result = __assign(__assign({}, attr), (result || {}));
}
else if (!isUndefined(attr) && attr !== null) {
result = attr;
break;
}
}
return result;
}
else {
return isFunction(attribute) ? attribute(args) : attribute;
}
}
export { value };