"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.serializeValue = void 0;
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
var serializeValue = exports.serializeValue = function serializeValue(value) {
  var valueType = (0, _typeof2.default)(value);
  if (value === null) {
    return 'null';
  } else if (value === undefined) {
    return 'undefined';
  } else if (valueType === 'string' || valueType === 'number') {
    return value;
  } else if (valueType === 'symbol') {
    return value.toString();
  }
  // Calling toString of function returns whole function text with body.
  // So, just return function with name.
  else if (valueType === 'function') {
    return "function:".concat(value.name);
  } else if (valueType === 'object') {
    return {
      type: 'object',
      keys: Object.keys(value)
    };
  }
};