UNPKG

tdesign-react

Version:
92 lines (83 loc) 2.39 kB
/** * tdesign v1.15.1 * (c) 2025 tdesign * @license MIT */ 'use strict'; var _baseGetTag = require('./dep-25585736.js'); var isArray = require('./dep-64577888.js'); var isSymbol = require('./dep-79629634.js'); /** * A specialized version of `_.map` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the new mapped array. */ function arrayMap(array, iteratee) { var index = -1, length = array == null ? 0 : array.length, result = Array(length); while (++index < length) { result[index] = iteratee(array[index], index, array); } return result; } /** Used as references for various `Number` constants. */ var INFINITY = 1 / 0; /** Used to convert symbols to primitives and strings. */ var symbolProto = _baseGetTag._Symbol ? _baseGetTag._Symbol.prototype : undefined, symbolToString = symbolProto ? symbolProto.toString : undefined; /** * The base implementation of `_.toString` which doesn't convert nullish * values to empty strings. * * @private * @param {*} value The value to process. * @returns {string} Returns the string. */ function baseToString(value) { // Exit early for strings to avoid a performance hit in some environments. if (typeof value == 'string') { return value; } if (isArray.isArray(value)) { // Recursively convert values (susceptible to call stack limits). return arrayMap(value, baseToString) + ''; } if (isSymbol.isSymbol(value)) { return symbolToString ? symbolToString.call(value) : ''; } var result = value + ''; return result == '0' && 1 / value == -INFINITY ? '-0' : result; } /** * Converts `value` to a string. An empty string is returned for `null` * and `undefined` values. The sign of `-0` is preserved. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to convert. * @returns {string} Returns the converted string. * @example * * _.toString(null); * // => '' * * _.toString(-0); * // => '-0' * * _.toString([1, 2, 3]); * // => '1,2,3' */ function toString(value) { return value == null ? '' : baseToString(value); } exports.arrayMap = arrayMap; exports.baseToString = baseToString; exports.toString = toString; //# sourceMappingURL=dep-255ceed8.js.map