All files / src/internal/client/reactivity equality.js

100% Statements 21/21
85.71% Branches 6/7
100% Functions 3/3
100% Lines 21/21

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 222x 2x 2x 9523x 9523x 2x 2x 2x 2x 2x 2x 2x 35459x 35459x 35459x 35459x 2x 2x 2x 34878x 34878x  
/** @import { Equals } from '#client' */
/** @type {Equals} */
export function equals(value) {
	return value === this.v;
}
 
/**
 * @param {unknown} a
 * @param {unknown} b
 * @returns {boolean}
 */
export function safe_not_equal(a, b) {
	return a != a
		? b == b
		: a !== b || (a !== null && typeof a === 'object') || typeof a === 'function';
}
 
/** @type {Equals} */
export function safe_equals(value) {
	return !safe_not_equal(value, this.v);
}