Optimize performance

This commit is contained in:
schmelczerandras 2020-10-26 14:18:36 +01:00
parent e4cd3284b7
commit b8ef90c100
31 changed files with 319 additions and 206 deletions

View file

@ -1,7 +1,9 @@
export const serialize = (object: any): string => {
return JSON.stringify(object, (_, value) => {
if (value?.__serializable_type) {
return [value.__serializable_type, ...value.toArray()];
const props = value.toArray() as Array<any>;
props.unshift(value.__serializable_type);
return props;
}
return value?.toFixed ? Number(value.toFixed(3)) : value;
});