(value, replacer, space)
| 703 | } |
| 704 | |
| 705 | function stringify (value, replacer, space) { |
| 706 | if (arguments.length > 1) { |
| 707 | let spacer = '' |
| 708 | if (typeof space === 'number') { |
| 709 | spacer = ' '.repeat(Math.max(0, Math.min(space, 10))) |
| 710 | } else if (typeof space === 'string') { |
| 711 | spacer = space.slice(0, 10) |
| 712 | } |
| 713 | if (replacer != null) { |
| 714 | if (typeof replacer === 'function') { |
| 715 | if (safe) { |
| 716 | replacer = makeSafe(replacer, replacer.name) |
| 717 | } |
| 718 | return stringifyFnReplacer('', { '': value }, [], replacer, spacer, '') |
| 719 | } |
| 720 | if (Array.isArray(replacer)) { |
| 721 | return typeof value === 'object' |
| 722 | ? stringifyArrayReplacer('', value, [], getUniqueReplacerSet(replacer), spacer, '') |
| 723 | : stringifyPrimitive(value) |
| 724 | } |
| 725 | } |
| 726 | if (spacer.length !== 0) { |
| 727 | return typeof value === 'object' |
| 728 | ? stringifyIndent('', value, [], spacer, '') |
| 729 | : stringifyPrimitive(value) |
| 730 | } |
| 731 | } |
| 732 | return typeof value === 'object' |
| 733 | ? stringifyObject('', value, []) |
| 734 | : stringifyPrimitive(value) |
| 735 | } |
| 736 | |
| 737 | return stringify |
| 738 | } |
no test coverage detected