function useKeyValueMap(flattenOptions) {
  return _react.default.useMemo(function () {
    var cacheKeyMap = new Map();
    var cacheValueMap = new Map(); // Cache options by key

    flattenOptions.forEach(function (dataNode) {
      cacheKeyMap.set(dataNode.key, dataNode);
      cacheValueMap.set(dataNode.data.value, dataNode);
    });
    return [cacheKeyMap, cacheValueMap];
  }, [flattenOptions]);
}
/**
 * Return cached Key Value map with DataNode.
 * Only re-calculate when `flattenOptions` changed.
 */
Return cached Key Value map with DataNode.
Only re-calculate when `flattenOptions` changed.
Return cached Key Value map with DataNode . Only re - calculate when ` flattenOptions ` changed .
function useKeyValueMap(flattenOptions) {
  return _react.default.useMemo(function () {
    var cacheKeyMap = new Map();
    var cacheValueMap = new Map(); 
    flattenOptions.forEach(function (dataNode) {
      cacheKeyMap.set(dataNode.key, dataNode);
      cacheValueMap.set(dataNode.data.value, dataNode);
    });
    return [cacheKeyMap, cacheValueMap];
  }, [flattenOptions]);
}
function useKeyValueMap ( flattenOptions ) { return _react . default . useMemo ( function ( ) { var cacheKeyMap = new Map ( ) ; var cacheValueMap = new Map ( ) ; flattenOptions . forEach ( function ( dataNode ) { cacheKeyMap . set ( dataNode . key , dataNode ) ; cacheValueMap . set ( dataNode . data . value , dataNode ) ; } ) ; return [ cacheKeyMap , cacheValueMap ] ; } , [ flattenOptions ] ) ; }
Return cached Key Value map with DataNode.
Return cached Key Value map with DataNode .
// Cache options by key