Skip to main content
Version: v8.0.0

replaceEqualDeep

Structural sharing - returns next with every part that is deeply equal to prev replaced by the prev reference. When both values are deeply equal the prev reference is returned, so consumers can rely on === checks. Only plain objects and arrays are traversed, other values are compared with Object.is .


Import
import { replaceEqualDeep } from "@hyper-fetch/core"

Parameters​

replaceEqualDeep<T>(prev: unknown, next: T)
Parameters
NameTypeDescription
prev
unknown

previous value

next
T

incoming value

Returns​

next sharing unchanged references with prev

T