* 7.7.1
* Extract stringify replacer
* formatting
* linting
* isUnSorted{A, B}
* Adjust
* Complexity?
* Cleanups
* Update packages/util-crypto/src/address/derive.ts
* formatBalance
* Revert formatBalance
17 lines
452 B
TypeScript
17 lines
452 B
TypeScript
// Copyright 2017-2021 @polkadot/util authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
function isByteZero (v: number): boolean {
|
|
return !v;
|
|
}
|
|
|
|
/**
|
|
* @name u8aEmpty
|
|
* @summary Tests for a `Uint8Array` for emptyness
|
|
* @description
|
|
* Checks to see if the input `Uint8Array` has zero length or contains all 0 values.
|
|
*/
|
|
export function u8aEmpty (value: Uint8Array): boolean {
|
|
return value.length === 0 || value.every(isByteZero);
|
|
}
|