@discoveryjs/discovery
Version:
Frontend framework for rapid data (JSON) analysis, shareable serverless reports and dashboards
25 lines (24 loc) • 725 B
JavaScript
import { hasOwn } from "../core/utils/object-utils.js";
import { jsonSafeParse, jsonSafeStringify, jsonStringifyInfo } from "../core/utils/json";
import { getImageContent, getImageDataUri, getImageSrc } from "../core/utils/image.js";
export default {
overrideProps,
jsonInfo: jsonStringifyInfo,
jsonParse: jsonSafeParse,
jsonStringify: jsonSafeStringify,
imagecontent: getImageContent,
imagedatauri: getImageDataUri,
imagesrc: getImageSrc
};
function overrideProps(current, props = this.context.props) {
if (!props) {
return current;
}
const result = { ...current };
for (const key of Object.keys(result)) {
if (hasOwn(props, key)) {
result[key] = props[key];
}
}
return result;
}