import React from 'react' ; export const useMemoOne = < T > ( compute , deps ? ) => { const value = React . useRef ( 'UNLOADED' ) ; const previousDeps = React . useRef ( deps ) ; if ( value . current === 'UNLOADED' || ! shallowEqual ( previousDeps . current , deps ) ) { previousDeps . current = deps ; value . current = compute ( ) ; } return ( value . current as any ) as T ; } ; var hasOwnProperty$1 = Object . prototype . hasOwnProperty ; function is ( x , y ) { return ( ( x === y && ( x !== 0 || 1 / x === 1 / y ) ) || ( x !== x && y !== y ) ) ; } function shallowEqual ( objA , objB ) { if ( is ( objA , objB ) ) { return true ; } if ( typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null ) { return false ; } var keysA = Object . keys ( objA ) ; var keysB = Object . keys ( objB ) ; if ( keysA . length !== keysB . length ) { return false ; } for ( var i = 0 ; i < keysA . length ; i ++ ) { if ( ! hasOwnProperty$1 . call ( objB , keysA [ i ] ) || ! is ( objA [ keysA [ i ] ] , objB [ keysA [ i ] ] ) ) { return false ; } } return true ; }