Skip to content
Snippets Groups Projects
Commit 42502dcf authored by Loïc Correnson's avatar Loïc Correnson Committed by Michele Alberti
Browse files

[dome] use fast-react-compare

parent ff83ea29
No related branches found
No related tags found
No related merge requests found
react@^16.8 react-dom source-map-support lodash react-virtualized react-draggable codemirror
react@^16.8 react-dom source-map-support lodash react-virtualized react-draggable react-fast-compare codemirror
......@@ -44,7 +44,6 @@
"eslint-plugin-react-hooks": "^3.0.0",
"html-loader": "1.0.0-alpha.0",
"jsdoc": "^3.6.3",
"react-fast-compare": "^3.2.0",
"react-hot-loader": "^4.12.20",
"serve": "^11.3.0",
"typedoc": "^0.17.6",
......@@ -62,6 +61,7 @@
"react-draggable": "^4.2.0",
"react-virtualized": "^9.21.2",
"source-map-support": "^0.5.16",
"react-fast-compare": "^3.2.0",
"zeromq": "^6.0.0-beta.5"
}
}
......@@ -8,6 +8,8 @@
@module dome/data/compare
*/
import FastCompare from 'react-fast-compare';
/**
Interface for comparison functions.
These function shall fullfill the following contract:
......@@ -22,11 +24,19 @@ export interface Order<A> {
(x: A, y: A): number;
}
/**
Deep structural equality.
Provided by [react-fast-compare]().
*/
export const isEqual = FastCompare;
/** Always returns 0. */
export function equal(_x: any, _y: any): 0 { return 0; }
/** Primitive comparison works on this type. */
export type bignum = bigint | number;
/** Non-NaN numbers and big-ints */
/** Detect Non-NaN numbers and big-ints. */
export function isBigNum(x: any): x is bignum {
return typeof (x) === 'bigint' || (typeof (x) === 'number' && !Number.isNaN(x));
}
......
......@@ -25,6 +25,7 @@ DOME_APP_PACKAGES= \
lodash \
react-virtualized \
react-draggable \
react-fast-compare \
codemirror
# --------------------------------------------------------------------------
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment