@jeremyckahn/farmhand
Version:
A farming game
13 lines (10 loc) • 310 B
text/typescript
import { MAX_ANIMAL_NAME_LENGTH } from '../../constants.js'
import { modifyCow } from './modifyCow.js'
export const changeCowName = (
state: farmhand.state,
cowId: string,
newName: string
): farmhand.state =>
modifyCow(state, cowId, () => ({
name: newName.slice(0, MAX_ANIMAL_NAME_LENGTH),
}))