File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -49,19 +49,20 @@ jsonNodeCount = (obj) ->
4949 for item in obj
5050 total += jsonNodeCount item
5151 else if _ .isObject obj
52+ total += _ .size obj
5253 for own key, val of obj
5354 total += jsonNodeCount val
5455 else
5556 total += 1
5657 return total
5758
5859xmlNodeCount = (obj ) ->
59- total = 0
60+ total = 1
6061 if obj .attributes
6162 total += _ .size obj .attributes
6263 if obj .instructions
6364 total += obj .instructions .length
64- if obj .children and obj . children . length > 0
65+ if obj .children
6566 for item in obj .children
6667 total += xmlNodeCount item
6768 return total
@@ -107,7 +108,6 @@ doTest = (file, rep) ->
107108 if not nodeCount
108109 nodeCount = xmlNodeCount xml .root ()
109110 console .log ' XML Node Count: ' + nodeCount
110- console .log xml .root ().children .length
111111 if not strSize
112112 strSize = Buffer .byteLength str, ' utf8'
113113 console .log ' XML String Size: ' + fmtSize (strSize)
You can’t perform that action at this time.
0 commit comments