rumble-charts
Version:
Truly declarative React charts components
34 lines (31 loc) • 1.03 kB
JavaScript
import { __assign } from '../external/tslib/tslib.es6.js';
import * as index from './transforms/index.js';
import { isString } from './isString.js';
import { isFunction } from './isFunction.js';
import { isObject } from './isObject.js';
function transform(props, method, options) {
if (options === void 0) { options = undefined; }
if (!Array.isArray(method)) {
method = [method];
}
return method.reduce(function (props, method) {
if (isString(method)) {
if (isFunction(index[method])) {
return __assign(__assign({}, props), index[method](props, options));
}
else {
return props;
}
}
else if (isFunction(method)) {
return __assign(__assign({}, props), method(props, options));
}
else if (isObject(method)) {
return transform(props, method.method, method.options);
}
else {
return props;
}
}, props);
}
export { transform };