@creejs/commons-lang 2.1.27 → 2.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1543,6 +1543,45 @@
1543
1543
  } else if (value === undefined) {
1544
1544
  return 'undefined'
1545
1545
  }
1546
+ const type = typeof value;
1547
+ if (type === 'string') {
1548
+ return value
1549
+ } else if (type === 'symbol') {
1550
+ return `Symbol(${value.description})`
1551
+ } else if (type === 'function') {
1552
+ return `Function ${value.name}(){}`
1553
+ }
1554
+ if (value instanceof String) {
1555
+ return value.toString()
1556
+ }
1557
+ if (Number.isNaN(value)) {
1558
+ return 'NaN'
1559
+ }
1560
+ if (value === Infinity) {
1561
+ return 'Infinity'
1562
+ }
1563
+ if (value === -Infinity) {
1564
+ return '-Infinity'
1565
+ }
1566
+ if (value instanceof Error) {
1567
+ return `${value.constructor.name}: ${value.message}`
1568
+ }
1569
+ if (value instanceof Promise) {
1570
+ return 'Promise'
1571
+ }
1572
+ if (value instanceof Set) {
1573
+ return `Set: ${safeToString(Array.from(value))}`
1574
+ }
1575
+ if (value instanceof Map) {
1576
+ return `Map: ${safeToString(Array.from(value.entries()))}`
1577
+ }
1578
+ if (value instanceof RegExp) {
1579
+ return value.toString()
1580
+ }
1581
+
1582
+ if (Array.isArray(value)) {
1583
+ return `[${value.map(safeToString).join(', ')}]`
1584
+ }
1546
1585
  let valueStr;
1547
1586
  try {
1548
1587
  valueStr = JSON.stringify(value);