sui-explorer-local
Version:
Local Sui Explorer
15 lines (13 loc) • 331 B
text/typescript
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
// Number Suffix
// TODO: Support bigint:
export const numberSuffix = (num: number): string => {
if (num >= 1000000) {
return (num / 1000000).toFixed(1) + 'M';
}
if (num >= 1000) {
return (num / 1000).toFixed(1) + 'K';
}
return num.toString();
};