toString.js 858 B

123456789101112131415161718192021
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = toString;
  6. function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
  7. function toString(input) {
  8. if (_typeof(input) === 'object' && input !== null) {
  9. if (typeof input.toString === 'function') {
  10. input = input.toString();
  11. } else {
  12. input = '[object Object]';
  13. }
  14. } else if (input === null || typeof input === 'undefined' || isNaN(input) && !input.length) {
  15. input = '';
  16. }
  17. return String(input);
  18. }
  19. module.exports = exports.default;
  20. module.exports.default = exports.default;