MCPcopy Create free account
hub / github.com/denoland/std / assertLessOrEqual

Function assertLessOrEqual

assert/less_or_equal.ts:24–36  ·  view source on GitHub ↗
(
  actual: T,
  expected: T,
  msg?: string,
)

Source from the content-addressed store, hash-verified

22 * @param msg The optional message to display if the assertion fails.
23 */
24export function assertLessOrEqual<T>(
25 actual: T,
26 expected: T,
27 msg?: string,
28) {
29 if (actual <= expected) return;
30
31 const actualString = format(actual);
32 const expectedString = format(expected);
33 throw new AssertionError(
34 msg ?? `Expect ${actualString} <= ${expectedString}`,
35 );
36}

Calls 1

formatFunction · 0.90

Tested by

no test coverage detected