@smartinvoicexyz/utils
Version:
Unified source for utility functions used across the Smart Invoice protocol.
12 lines (11 loc) • 331 B
JavaScript
export const getKeys = (record) => Object.keys(record);
export function hashCode(s) {
if (!s)
return 0;
let h = 0;
// eslint-disable-next-line no-plusplus
for (let i = 0; i < s.length; i++)
// eslint-disable-next-line no-bitwise
h = (Math.imul(31, h) + s.charCodeAt(i)) | 0;
return h;
}