@newdash/newdash
Version:
javascript/typescript utility library
31 lines (26 loc) • 738 B
TypeScript
/**
* Object.toHashCode
*
* remember: the **SAME** structure object will return the **SAME** hash code
*
* @category Functional
* @since 5.15.0
* @param obj anything in js
*
* @returns the hash of the object (string(32))
*
* ```ts
const a1 = [1, 2, 3, 4];
const a2 = [1, 2, 3, 4];
expect(toHashCode(a1)).toBe(toHashCode(a2));
const o1 = { a: 1 };
const o2 = { a: 1 };
const o3 = { a: 2 };
expect(toHashCode(o1)).toBe(toHashCode(o2));
expect(toHashCode(o1)).not.toBe(toHashCode(o3));
expect(toHashCode('simple')).toBe(toHashCode('simple'));
expect(toHashCode('11')).not.toBe(toHashCode(11));
* ```
*/
export declare function toHashCode(obj: any): string;
export default toHashCode;