
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@cennznet/util
Advanced tools
Utils for CENNZNet
<Const> INTEGERâ—Ź INTEGER: RegExp = /^\d+$/
Defined in packages/util/src/is/integer.ts:15
<Const> STRIP_ZEROâ—Ź STRIP_ZERO: RegExp = /^(.?)(0)$/
Defined in packages/util/src/format/stripEndZero.ts:17
â–¸ formatUnits(unValue: BN | number | string, decimals: number): string
Defined in packages/util/src/unit/formatUnits.ts:25
format a amount from unit un to decimals passed in.
Parameters:
| Name | Type | Description |
|---|---|---|
| unValue | BN | number | string | - |
| decimals | number |
Returns: string
â–¸ isSafeInteger(value: any): boolean
Defined in packages/util/src/is/integer.ts:30
Check if the input is a integer
example:
import { isInteger } from '@cennznet/util';
console.log('isInteger', isInteger(123)); // => true
console.log('isInteger', isInteger(123456789012345678)); // => false
console.log('isInteger', isInteger('123')); // => true
console.log('isInteger', isInteger('12.3')); // => false
Parameters:
| Name | Type |
|---|---|
| value | any |
Returns: boolean
â–¸ parseUnits(value: string | number, decimals: number): BN
Defined in packages/util/src/unit/parseUnits.ts:27
format a amount from unit un to decimals passed in.
Parameters:
| Name | Type | Description |
|---|---|---|
| value | string | number | |
| decimals | number |
Returns: BN
â–¸ stripEndZero(value: string): string
Defined in packages/util/src/format/stripEndZero.ts:23
trim all trailing zeros. return '' if only zero is passed in.
Parameters:
| Name | Type | Description |
|---|---|---|
| value | string |
Returns: string
â–¸ toFixed(x: number): string
Defined in packages/util/src/number/toFixed.ts:19
convert number to string, without science notion
Parameters:
| Name | Type | Description |
|---|---|---|
| x | number |
Returns: string
FAQs
utils for CENNZnet api
We found that @cennznet/util demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.