# eq

## 用法

eq.example.ts
eq.test.ts
eq.example.ts
`import { eq } from "./ddzy/utility/others/eq";​// ? 基本类型值const s1 = [100, 100];const p1 = eq(s1, s1);console.log(p1);​console.log('----------------');​// ? 引用类型值, 指向不同的内存地址const s2 = [{}, {}];const p2 = eq(s2, s2);console.log(p2);​console.log('------------------');​// ? 引用类型值, 指向相同的内存地址const o3 = {};const s3 = [o3, o3];const p3 = eq(s3, s3);console.log(p3);​console.log('-------------------');​// ? 都为NaN, 也是相等const s4 = [NaN, NaN];const p4 = eq(s4, s4);console.log(p4);`
eq.test.ts
`import { eq } from "../../utility/others/eq";​describe('eq tests: ', () => {  test('eq should return true or false when receive two basic value that equals', () => {    const received = [100, 100];    const expected = true;​    const result = eq(received, received);​    expect(result).toBe(expected);  });​  test('eq should return false when receive two object but point at different memory', () => {    const received = [{}, {}];    const expected = false;​    const result = eq(received, received);​    expect(result).toBe(expected);  });​  test('eq should return true when receive two object point at same memory', () => {    const obj = {};​    const received = [obj, obj];    const expected = true;​    const result = eq(received, received);​    expect(result).toBe(expected);  });​  test('eq should return true when receive two NaN value', () => {    const received = [NaN, NaN];    const expected = true;​    const result = eq(received, received);​    expect(result).toBe(expected);  });});`