1. /**
    
  2.  * Copyright (c) Meta Platforms, Inc. and affiliates.
    
  3.  *
    
  4.  * This source code is licensed under the MIT license found in the
    
  5.  * LICENSE file in the root directory of this source tree.
    
  6.  */
    
  7. 
    
  8. /**
    
  9.  * `ReactInstanceMap` maintains a mapping from a public facing stateful
    
  10.  * instance (key) and the internal representation (value). This allows public
    
  11.  * methods to accept the user facing instance as an argument and map them back
    
  12.  * to internal methods.
    
  13.  *
    
  14.  * Note that this module is currently shared and assumed to be stateless.
    
  15.  * If this becomes an actual Map, that will break.
    
  16.  */
    
  17. 
    
  18. /**
    
  19.  * This API should be called `delete` but we'd have to make sure to always
    
  20.  * transform these to strings for IE support. When this transform is fully
    
  21.  * supported we can rename it.
    
  22.  */
    
  23. export function remove(key) {
    
  24.   key._reactInternals = undefined;
    
  25. }
    
  26. 
    
  27. export function get(key) {
    
  28.   return key._reactInternals;
    
  29. }
    
  30. 
    
  31. export function has(key) {
    
  32.   return key._reactInternals !== undefined;
    
  33. }
    
  34. 
    
  35. export function set(key, value) {
    
  36.   key._reactInternals = value;
    
  37. }