fix(editor): Improve error messages around pinned data (#9632)

This commit is contained in:
Milorad FIlipović
2024-06-05 13:48:55 +02:00
committed by GitHub
parent 37531cdb7d
commit a8bb53f4e3
6 changed files with 51 additions and 15 deletions

View File

@@ -63,6 +63,11 @@ export function stringSizeInBytes(input: string | IDataObject | IDataObject[] |
return new Blob([typeof input === 'string' ? input : JSON.stringify(input)]).size;
}
export function toMegaBytes(bytes: number, decimalPlaces: number = 2): number {
const megabytes = bytes / 1024 / 1024;
return parseFloat(megabytes.toFixed(decimalPlaces));
}
export function shorten(s: string, limit: number, keep: number) {
if (s.length <= limit) {
return s;