UNPKG

513 BJavaScriptView Raw
1// Copyright 2017-2022 @polkadot/util authors & contributors
2// SPDX-License-Identifier: Apache-2.0
3import { u8aCmp } from "./cmp.js";
4/**
5 * @name u8aSorted
6 * @summary Sorts an array of Uint8Arrays
7 * @description
8 * For input `UInt8Array[]` return the sorted result
9 * @example
10 * <BR>
11 *
12 * ```javascript
13 * import { u8aSorted} from '@polkadot/util';
14 *
15 * u8aSorted([new Uint8Array([0x69]), new Uint8Array([0x68])]); // [0x68, 0x69]
16 * ```
17 */
18
19export function u8aSorted(u8as) {
20 return u8as.sort(u8aCmp);
21}
\No newline at end of file