From 6c26c15e23e64963e811a19b36aba215a3c8c32b Mon Sep 17 00:00:00 2001 From: Angelos Chalaris Date: Mon, 1 Jan 2018 20:00:50 +0200 Subject: [PATCH] Update prettyBytes.md --- snippets/prettyBytes.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/snippets/prettyBytes.md b/snippets/prettyBytes.md index c959b66d8..f8e00917f 100644 --- a/snippets/prettyBytes.md +++ b/snippets/prettyBytes.md @@ -8,8 +8,7 @@ Return the prettified string by building it up, taking into account the supplied negative or not. ```js -const prettyBytes = (num, options) => { - options = { precision: 3, addSpace: true, ...options }; +const prettyBytes = (num, precision = 3, addSpace = true) { const UNITS = ['B','KB','MB','GB','TB','PB','EB','ZB','YB']; if (num < 1) return (num < 0 ? '-' : '') + num + ' B'; const exponent = Math.min(Math.floor(Math.log10(num < 0 ? -num : num) / 3), UNITS.length - 1);