Files
pezkuwi-vanitygen/src/sort.ts
Kurdistan Tech Ministry 6a860cecfe Initial commit: Fork @polkadot/vanitygen to @pezkuwi/vanitygen
- Replace all @polkadot/* dependencies with @pezkuwi/*
- Update package.json metadata for Pezkuwichain
- Update CLI command from polkadot-js-vanitygen to pezkuwi-vanitygen
- Update network options: bizinikiwi, pezkuwi, dicle, zagros
- Set default network to pezkuwi (ss58Format: 42)
- Update documentation and README
- Build and test successful
- Version 1.0.0
2026-01-11 23:22:39 +03:00

31 lines
649 B
TypeScript

// Copyright 2017-2025 @pezkuwi/vanitygen authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { GeneratorMatch } from './types.js';
function numberSort (a: number, b: number): number {
if (a > b) {
return -1;
} else if (a < b) {
return 1;
}
return 0;
}
export default function sort (a: GeneratorMatch, b: GeneratorMatch): number {
const countResult = numberSort(a.count, b.count);
if (countResult !== 0) {
return countResult;
}
const positionResult = numberSort(b.offset, a.offset);
if (positionResult !== 0) {
return positionResult;
}
return a.address.localeCompare(b.address);
}