aboutsummaryrefslogtreecommitdiff
path: root/src/Utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/Utils.ts')
-rw-r--r--src/Utils.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Utils.ts b/src/Utils.ts
index b5c218e01..502cf7db7 100644
--- a/src/Utils.ts
+++ b/src/Utils.ts
@@ -7,6 +7,7 @@ import { Socket } from '../node_modules/socket.io/dist/index';
import { DocumentType } from './client/documents/DocumentTypes';
import { Colors } from './client/views/global/globalEnums';
import { Message } from './server/Message';
+import { DocumentView } from './client/views/nodes/DocumentView';
export namespace Utils {
export let CLICK_TIME = 300;
@@ -513,6 +514,10 @@ export function intersectRect(r1: { left: number; top: number; width: number; he
return !(r2.left > r1.left + r1.width || r2.left + r2.width < r1.left || r2.top > r1.top + r1.height || r2.top + r2.height < r1.top);
}
+export function stringHash(s?:string) {
+ return !s? undefined: Math.abs(s.split('').reduce((a: any, b: any) => ((a) => a & a)((a << 5) - a + b.charCodeAt(0)),0));
+}
+
export function percent2frac(percent: string) {
return Number(percent.substr(0, percent.length - 1)) / 100;
}
@@ -583,7 +588,7 @@ export function returnEmptyDoclist() {
return [] as any[];
}
-export let emptyPath = [];
+export let emptyPath: DocumentView[] = [];
export function emptyFunction() {
return undefined;