Skip to content

Commit 1f7c29e

Browse files
authored
Merge pull request #34 from aaronshaf/improvement/map-display
More readable formatting of maps (with white space preserved)
2 parents d086b01 + 55f5b8b commit 1f7c29e

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

lib/backend.js

+3-11
Original file line numberDiff line numberDiff line change
@@ -363,17 +363,9 @@ exports.createServer = (dynamodb, docClient) => {
363363
? encodeURIComponent(JSON.stringify(nextKey))
364364
: null
365365

366-
const Items = pageItems.map(item => {
367-
for (const [key, value] of Object.entries(item)) {
368-
if (value && typeof (value) === 'object' &&
369-
!Array.isArray(value)) {
370-
item[key] = JSON.stringify(value, null, 2);
371-
}
372-
}
373-
return Object.assign({}, item, {
374-
__key: extractKey(item, description.Table.KeySchema)
375-
})
376-
});
366+
const Items = pageItems.map(item => Object.assign({}, item, {
367+
__key: extractKey(item, description.Table.KeySchema)
368+
}));
377369
const UniqueKeys = extractKeysForItems(Items);
378370

379371
const data = Object.assign({}, description, {

views/partials/head.ejs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<style>
77
body {font-size: 0.8rem;padding-top: 20px;}
88
a pre {color: inherit;}
9+
.preformatted {white-space: pre;}
910
/* go away, LastPass */
1011
form[autocomplete="off"] input[type="text"] {
1112
background-position: 150% 50% !important;

views/scan.ejs

+2
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@
187187
title="<%= dateValue %>">
188188
<%= item[column] %>
189189
</abbr>
190+
<% } else if (value && typeof (value) === 'object') { %>
191+
<div class="preformatted"><%= JSON.stringify(value, null, 4) %></div>
190192
<% } else { %>
191193
<%= item[column] %>
192194
<% } %>

0 commit comments

Comments
 (0)