diff --git a/src/libs/hashCode.js b/src/libs/hashCode.ts similarity index 80% rename from src/libs/hashCode.js rename to src/libs/hashCode.ts index a95d0787a6e3..bb0522c25de0 100644 --- a/src/libs/hashCode.js +++ b/src/libs/hashCode.ts @@ -2,11 +2,11 @@ /** * Simple string hashing function obtained from: https://stackoverflow.com/a/8831937/16434681 * Returns a hash code from a string - * @param {String} str The string to hash. - * @return {Number} A 32bit integer (can be negative) + * @param str The string to hash. + * @return A 32bit integer (can be negative) * @see http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/ */ -function hashCode(str) { +function hashCode(str: string): number { let hash = 0; for (let i = 0, len = str.length; i < len; i++) { const chr = str.charCodeAt(i);