Skip to content

Commit

Permalink
fix: show prop and item instead of plural when there is only one …
Browse files Browse the repository at this point in the history
…property or item
  • Loading branch information
josdejong committed Apr 13, 2022
1 parent dcaf99a commit 1f1725f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/lib/components/modes/treemode/JSONNode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -490,12 +490,14 @@
{#if expanded}
<div class="bracket">[</div>
<span class="tag readonly">
{resolvedValue.length} items
{resolvedValue.length}
{resolvedValue.length === 1 ? 'item' : 'items'}
</span>
{:else}
<div class="bracket">[</div>
<button type="button" class="tag" on:click={handleExpand}>
{resolvedValue.length} items
{resolvedValue.length}
{resolvedValue.length === 1 ? 'item' : 'items'}
</button>
<div class="bracket">]</div>
{/if}
Expand Down Expand Up @@ -615,7 +617,8 @@
{:else}
<div class="bracket">&lbrace;</div>
<button type="button" class="tag" on:click={handleExpand}>
{Object.keys(resolvedValue).length} props
{Object.keys(resolvedValue).length}
{Object.keys(resolvedValue).length === 1 ? 'prop' : 'props'}
</button>
<div class="bracket">&rbrace;</div>
{/if}
Expand Down

0 comments on commit 1f1725f

Please sign in to comment.