MCPcopy
hub / github.com/bgrins/TinyColor / assertStrictEquals

Function assertStrictEquals

npm/deno_asserts@0.168.0.mjs:503–530  ·  view source on GitHub ↗
(actual, expected, msg)

Source from the content-addressed store, hash-verified

501 throw new AssertionError(msg);
502}
503function assertStrictEquals(actual, expected, msg) {
504 if (Object.is(actual, expected)) {
505 return;
506 }
507 let message;
508 if (msg) {
509 message = msg;
510 } else {
511 const actualString = format(actual);
512 const expectedString = format(expected);
513 if (actualString === expectedString) {
514 const withOffset = actualString.split("\n").map((l)=>` ${l}`).join("\n");
515 message = `Values have the same structure but are not reference-equal:\n\n${red(withOffset)}\n`;
516 } else {
517 try {
518 const stringDiff = typeof actual === "string" && typeof expected === "string";
519 const diffResult = stringDiff ? diffstr(actual, expected) : diff(actualString.split("\n"), expectedString.split("\n"));
520 const diffMsg = buildMessage(diffResult, {
521 stringDiff
522 }).join("\n");
523 message = `Values are not strictly equal:\n${diffMsg}`;
524 } catch {
525 message = `\n${red(CAN_NOT_DISPLAY)} + \n\n`;
526 }
527 }
528 }
529 throw new AssertionError(message);
530}
531function assertNotStrictEquals(actual, expected, msg) {
532 if (!Object.is(actual, expected)) {
533 return;

Callers

nothing calls this directly

Calls 5

formatFunction · 0.85
redFunction · 0.85
diffstrFunction · 0.85
diffFunction · 0.85
buildMessageFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…