Skip to content

Commit 1490bc5

Browse files
zalmoxisusblakeembrey
authored andcommitted
Fix TypeError: Cannot read property 'split' of undefined (#3)
1 parent 795b55d commit 1490bc5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

javascript-stringify.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@
9898
'[object Array]': function (array, indent, stringify) {
9999
// Map array values to their stringified values with correct indentation.
100100
var values = array.map(function (value) {
101-
return indent + stringify(value).split('\n').join('\n' + indent);
101+
var str = stringify(value);
102+
return indent + (str && str.split('\n').join('\n' + indent));
102103
}).join(indent ? ',\n' : ',');
103104

104105
// Wrap the array in newlines if we have indentation set.

0 commit comments

Comments
 (0)