deno land nest badge

npm version bundle size npm download dependencies Status codecov Codacy Badge npm type definitions Commitizen friendly Gitmoji semantic-release

equal === lauqe

Deep comparison between two values to determine if they are equivalent

✨ Feature

  • ⚡ Multi runtime support (Deno, Node.js and Browsers)
  • 📚 Pure TypeScript and provides type definition
  • :white_check_mark: Rambda’s all test case is passed
  • :earth_americas: Universal module, providing ES modules and UMD
  • :package: Optimized, super slim size
  • 📄 TSDoc-style comments

📝 API

declare const equal: <T, U extends T>(a: T, b: U) => boolean
Parameter Description
a Any value
b Any value

=> Return true if the reference memory is the same or the property members and their values are the same

Definition of Equality

Equality is defined as the data structure and property values are equivalent.

Same-value-zero

Numerical equivalence is based on Same-value-zero.
That is, all of the following comparisons are considered equivalent.

equal(NaN, NaN) // true
equal(0, 0) // true
equal(+0, 0) // true
equal(-0, 0) // true
equal(+0, -0) // true

💚 Supports

Browser is supporting since IE11.

The TypeScript version must be 4.1.0 or higher.

Deno
Deno
Node.js
Node.js
IE / Edge
IE / Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
iOS Safari
iOS Safari
Samsung
Samsung
Opera
Opera
>= 1.6.0 >= 10.24.0 IE11 / last 2 versions last 2 versions last 2 versions last 2 versions last 2 versions last 2 versions last 2 versions

💫 Usage

equal provides multi platform modules.

🦕 Deno

deno.land

import { equal } from "https://deno.land/x/equal/mod.ts";

equal([1, 2, 3], [1, 2, 3]); // true

nest.land

import { equal } from "https://x.nest.land/equal/mod.ts";

equal([1, ['hello', ['world']], [1, ['hello', ['world']]); // true

:package: Node.js

NPM package name is lauqe .

Install

npm i lauqe
or
yarn add lauqe

ESM

import { equal } from "lauqe";

equal(new Date('2000/1/1'), new Date('2000/1/1')); // true

UMD

const { equal } = require("lauqe");

equal(/hello/g, /hello/g); // true

:globe_with_meridians: Browser

ESM

<script type="module">
  import { equal } from "https://unpkg.com/lauqe?module";
  console.log(equal(() => {}, () => {}); // true
</script>

UMD

<script src="https://unpkg.com/lauqe"></script>

<script>
  console.log(E.equal(NaN, NaN)); // true
</script>

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues.

🌱 Show your support

Give a ⭐️ if this project helped you!

💡 License

Copyright © 2021-present TomokiMiyauci.

Released under the MIT license