From 7948aa6181ec34cd2c55a3945721af747321bb40 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Tue, 22 Jun 2021 21:10:29 +0100 Subject: [PATCH] Iterate PR, improve jsdoc and switch function style --- src/utils/arrays.ts | 8 ++++---- src/utils/stringOrderField.ts | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/utils/arrays.ts b/src/utils/arrays.ts index 148861e5d3..6524debfb7 100644 --- a/src/utils/arrays.ts +++ b/src/utils/arrays.ts @@ -225,10 +225,10 @@ export function arrayMerge(...a: T[][]): T[] { /** * Moves a single element from fromIndex to toIndex. - * @param list the list from which to construct the new list. - * @param fromIndex the index of the element to move. - * @param toIndex the index of where to put the element. - * @returns A new array with the requested value moved. + * @param {array} list the list from which to construct the new list. + * @param {number} fromIndex the index of the element to move. + * @param {number} toIndex the index of where to put the element. + * @returns {array} A new array with the requested value moved. */ export function moveElement(list: T[], fromIndex: number, toIndex: number): T[] { const result = Array.from(list); diff --git a/src/utils/stringOrderField.ts b/src/utils/stringOrderField.ts index b312b85b08..da840792ee 100644 --- a/src/utils/stringOrderField.ts +++ b/src/utils/stringOrderField.ts @@ -18,13 +18,13 @@ import { alphabetPad, baseToString, stringToBase, DEFAULT_ALPHABET } from "matri import { moveElement } from "./arrays"; -export const midPointsBetweenStrings = ( +export function midPointsBetweenStrings( a: string, b: string, count: number, maxLen: number, alphabet = DEFAULT_ALPHABET, -): string[] => { +): string[] { const padN = Math.min(Math.max(a.length, b.length), maxLen); const padA = alphabetPad(a, padN, alphabet); const padB = alphabetPad(b, padN, alphabet); @@ -48,7 +48,7 @@ export const midPointsBetweenStrings = ( const step = (baseB - baseA) / BigInt(count + 1); const start = BigInt(baseA + step); return Array(count).fill(undefined).map((_, i) => baseToString(start + (BigInt(i) * step), alphabet)); -}; +} interface IEntry { index: number;