code: function packValue(value) {
              const result = memoizedMap.get(value);
              if (result == null) {
                  if (value >= MIN_DICT_INDEX && value <= MAX_VERBATIM_INTEGER && Number.isInteger(value))
                      return -value;
                  
                  memoize(value);
                  
                  if (typeof value === "number")
                      return String(value);
                  if (/^[0-9\.]|^~/.test(value))
                      return `~${value}`;
                  return value;
              }
              return result;
          }
docs: Pack and memoize a scalar value.