UNPKG

@firecms/core

Version:

Awesome Firebase/Firestore-based headless open-source CMS

12 lines (11 loc) 289 B
export function hashString(str: string): number { let hash = 0; let i; let chr; for (i = 0; i < str.length; i++) { chr = str.charCodeAt(i); hash = ((hash << 5) - hash) + chr; hash |= 0; // Convert to 32bit integer } return Math.abs(hash); }