Iterate PR, improve jsdoc and switch function style
This commit is contained in:
parent
e7fde2686f
commit
7948aa6181
2 changed files with 7 additions and 7 deletions
|
@ -225,10 +225,10 @@ export function arrayMerge<T>(...a: T[][]): T[] {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves a single element from fromIndex to toIndex.
|
* Moves a single element from fromIndex to toIndex.
|
||||||
* @param list the list from which to construct the new list.
|
* @param {array} list the list from which to construct the new list.
|
||||||
* @param fromIndex the index of the element to move.
|
* @param {number} fromIndex the index of the element to move.
|
||||||
* @param toIndex the index of where to put the element.
|
* @param {number} toIndex the index of where to put the element.
|
||||||
* @returns A new array with the requested value moved.
|
* @returns {array} A new array with the requested value moved.
|
||||||
*/
|
*/
|
||||||
export function moveElement<T>(list: T[], fromIndex: number, toIndex: number): T[] {
|
export function moveElement<T>(list: T[], fromIndex: number, toIndex: number): T[] {
|
||||||
const result = Array.from(list);
|
const result = Array.from(list);
|
||||||
|
|
|
@ -18,13 +18,13 @@ import { alphabetPad, baseToString, stringToBase, DEFAULT_ALPHABET } from "matri
|
||||||
|
|
||||||
import { moveElement } from "./arrays";
|
import { moveElement } from "./arrays";
|
||||||
|
|
||||||
export const midPointsBetweenStrings = (
|
export function midPointsBetweenStrings(
|
||||||
a: string,
|
a: string,
|
||||||
b: string,
|
b: string,
|
||||||
count: number,
|
count: number,
|
||||||
maxLen: number,
|
maxLen: number,
|
||||||
alphabet = DEFAULT_ALPHABET,
|
alphabet = DEFAULT_ALPHABET,
|
||||||
): string[] => {
|
): string[] {
|
||||||
const padN = Math.min(Math.max(a.length, b.length), maxLen);
|
const padN = Math.min(Math.max(a.length, b.length), maxLen);
|
||||||
const padA = alphabetPad(a, padN, alphabet);
|
const padA = alphabetPad(a, padN, alphabet);
|
||||||
const padB = alphabetPad(b, padN, alphabet);
|
const padB = alphabetPad(b, padN, alphabet);
|
||||||
|
@ -48,7 +48,7 @@ export const midPointsBetweenStrings = (
|
||||||
const step = (baseB - baseA) / BigInt(count + 1);
|
const step = (baseB - baseA) / BigInt(count + 1);
|
||||||
const start = BigInt(baseA + step);
|
const start = BigInt(baseA + step);
|
||||||
return Array(count).fill(undefined).map((_, i) => baseToString(start + (BigInt(i) * step), alphabet));
|
return Array(count).fill(undefined).map((_, i) => baseToString(start + (BigInt(i) * step), alphabet));
|
||||||
};
|
}
|
||||||
|
|
||||||
interface IEntry {
|
interface IEntry {
|
||||||
index: number;
|
index: number;
|
||||||
|
|
Loading…
Reference in a new issue