open-nomad/ui/app/helpers/format-bytes.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

22 lines
495 B
JavaScript
Raw Normal View History

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
import Helper from '@ember/component/helper';
import { formatBytes } from 'nomad-ui/utils/units';
2017-10-17 01:45:07 +00:00
/**
* Bytes Formatter
*
* Usage: {{format-bytes bytes start="KiB"}}
2017-10-17 01:45:07 +00:00
*
* Outputs the bytes reduced to the largest supported unit size for which
* bytes is larger than one.
*/
function formatBytesHelper([bytes], { start }) {
return formatBytes(bytes, start);
2017-10-17 01:45:07 +00:00
}
export default Helper.helper(formatBytesHelper);