Some checks failed
Deploy MineGeo to Dokploy / deploy (push) Failing after 6m4s
14 lines
397 B
TypeScript
14 lines
397 B
TypeScript
import type { DifficultyPreset } from "./protocol";
|
|
|
|
// A list fetched before a save must not remove the newly saved preset.
|
|
export function mergeDifficultyPresets(
|
|
current: DifficultyPreset[],
|
|
incoming: DifficultyPreset[],
|
|
) {
|
|
return [
|
|
...new Map(
|
|
[...current, ...incoming].map((preset) => [preset.id, preset]),
|
|
).values(),
|
|
].sort((a, b) => a.name.localeCompare(b.name));
|
|
}
|