Options
All
  • Public
  • Public/Protected
  • All
Menu

Module functional/toHashCode

Index

References

Functions Functional

References

Renames and re-exports toHashCode

Functional Functions

  • toHashCode(obj: any): string
  • Object.toHashCode

    remember: the SAME structure object will return the SAME hash code

    since

    5.15.0

    Parameters

    • obj: any

      anything in js

    Returns string

    the hash of the object (string(32))

    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));