//@ts-check

/**
 * @typedef {import("./parseFileList.mjs").ParsedLine} ParsedLine
 */

/**
 * Sorts a list of parsed lines by a given property in-place
 * @param {ParsedLine[]} lines
 * @param {keyof ParsedLine} property
 */
export const sortFileListLines = (lines, property = 'date_unix') =>
  lines.sort(({ [property]: a }, { [property]: b }) => a - b);

export default sortFileListLines