deno.land / std@0.224.0 / semver / format_range.ts

format_range.ts
View Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.// This module is browser compatible.import { format } from "./format.ts";import type { Comparator, Range } from "./types.ts";
function formatComparator(comparator: Comparator): string { const { operator } = comparator; return `${operator === undefined ? "" : operator}${format(comparator)}`;}
/** * Formats the range into a string * @example >=0.0.0 || <1.0.0 * @param range The range to format * @returns A string representation of the range */export function formatRange(range: Range): string { return range.map((c) => c.map((c) => formatComparator(c)).join(" ")) .join("||");}
std

Version Info

Tagged at
6 months ago