// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.
import { compare } from "./compare.ts";
import type { SemVer } from "./types.ts";

/**
 * Returns `true` if both semantic versions are logically equivalent, even if they're not the exact same version object.
 *
 * This is equal to `compare(s0, s1) === 0`.
 *
 * @example Usage
 * ```ts
 * import { parse, equals } from "@std/semver";
 * import { assert, assertFalse } from "@std/assert";
 *
 * const s0 = parse("1.2.3");
 * const s1 = parse("1.2.3");
 *
 * assert(equals(s0, s1));
 * assertFalse(equals(s0, parse("1.2.4")));
 * ```
 *
 * @param s0 The first SemVer to compare
 * @param s1 The second SemVer to compare
 * @returns `true` if `s0` is equal to `s1`, `false` otherwise
 */
export function equals(s0: SemVer, s1: SemVer): boolean {
  return compare(s0, s1) === 0;
}

// denoCacheMetadata={"headers":{"content-length":"890","cf-cache-status":"HIT","content-security-policy":"default-src 'none'; script-src 'none'; style-src 'none'; img-src 'none'; font-src 'none'; connect-src 'none'; frame-src 'none'; object-src 'none'; frame-ancestors 'none'; sandbox; form-action 'none';","cf-ray":"a223e657ca957db6-LAX","cache-control":"public, max-age=31536000, immutable","set-cookie":"__cf_bm=50VG8Uf91qi8ZWCYfIfdkzmTZxux5A__G8UXkmxcLIQ-1785241875.1722376-1.0.1.1-KjYXW_.nK2E3d4pXjbSlJdNvLA6fZnsixpg1ns2dLPj7ayJJDl2i4W4T3gM3o2m_4i5yy_u3eem8S8NDtvqHSUJMwYGOyYjYcsgLqqwa6Ebkkvc7FgMm2i9_EonVt38g; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 28 Jul 2026 13:01:15 GMT","vary":"Origin","accept-ranges":"bytes","access-control-expose-headers":"*","age":"3116065","content-type":"text/typescript","access-control-allow-origin":"*","etag":"\"bcfba545a0c53f315f326b93a7c310ba\"","date":"Tue, 28 Jul 2026 12:31:15 GMT","cross-origin-resource-policy":"cross-origin","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=zdpNu3EbNklqS9ZNQHeNXraGFTu3OQMh5m8X69ir4XIUaa7Nb7KGau9jmGQ74kClPswXgOxjD0hcAQDy0m63uBmFHwvUTMek06VJCqmtNUKEdVdQHPICn5c%3D\"}]}","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","alt-svc":"h3=\":443\"; ma=86400","x-content-type-options":"nosniff","x-robots-tag":"noindex","server":"cloudflare","x-jsr-backend":"modules"},"url":"https://jsr.io/@std/semver/0.224.3/equals.ts","time":1785241875}