Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecation(semver): deprecate ltr() and gtr() #4228

Merged
merged 5 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions semver/gtr.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import type { Range, SemVer, SemVerRange } from "./types.ts";
import { rangeMax } from "./range_max.ts";
import { gt } from "./gt.ts";
import { greaterThan } from "./greater_than.ts";
import { warnOnDeprecatedApi } from "../internal/warn_on_deprecated_api.ts";

/** Checks to see if the version is greater than all possible versions of the range. */
/**
* Checks to see if the version is greater than all possible versions of the range.
* @deprecated (will be removed after 0.215.0) Use `greaterThan(version, rangeMax(range))` instead.
kt3k marked this conversation as resolved.
Show resolved Hide resolved
*/
export function gtr(
version: SemVer,
range: SemVerRange | Range,
): boolean {
return gt(version, rangeMax(range));
warnOnDeprecatedApi({
apiName: "gtr",
stack: new Error().stack!,
removalVersion: "0.215.0",
suggestion: "Use 'greaterThan(version, rangeMax(range))' instead.",
});
return greaterThan(version, rangeMax(range));
}
16 changes: 13 additions & 3 deletions semver/ltr.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import type { Range, SemVer, SemVerRange } from "./types.ts";
import { lt } from "./lt.ts";
import { lessThan } from "./less_than.ts";
import { rangeMin } from "./range_min.ts";
import { warnOnDeprecatedApi } from "../internal/warn_on_deprecated_api.ts";

/** Less than range comparison */
/**
* Less than range comparison
* @deprecated (will be removed after 0.215.0) Use `lessThan(version, rangeMin(range))` instead.
kt3k marked this conversation as resolved.
Show resolved Hide resolved
*/
export function ltr(
version: SemVer,
range: SemVerRange | Range,
): boolean {
return lt(version, rangeMin(range));
warnOnDeprecatedApi({
apiName: "ltr",
stack: new Error().stack!,
removalVersion: "0.215.0",
suggestion: "Use 'lessThan(version, rangeMin(range))' instead.",
});
return lessThan(version, rangeMin(range));
}
Loading