Skip to content

Instantly share code, notes, and snippets.

@yano3nora
Created September 25, 2022 17:48
Show Gist options
  • Save yano3nora/625e826c0c34a35032bce4ea1c2841be to your computer and use it in GitHub Desktop.
Save yano3nora/625e826c0c34a35032bce4ea1c2841be to your computer and use it in GitHub Desktop.
[js: fast-deep-equal] #js
/**
* https://github.com/epoberezkin/fast-deep-equal
*/
import equal from 'fast-deep-equal'
/**
* rxjs で complex な state の前後比較のため
* distinctUntilChanged に食わせる想定の
* array, object 対応な深い比較用 callback
*/
export const deepComparator = <T>(a: T, b: T) => equal(a, b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment