refactor: clean up imports, fix typos, and enhance pet action handling
This commit is contained in:
14
src/utils/petUtils.ts
Normal file
14
src/utils/petUtils.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { PetAction } from '../types/PetUpdateActionRequest';
|
||||
|
||||
export function isGatheringAction(action: PetAction): boolean {
|
||||
return action.startsWith('GATHERING_');
|
||||
}
|
||||
|
||||
export function getResourceFromAction(action: PetAction): string | null {
|
||||
if (!isGatheringAction(action)) return null;
|
||||
return action.replace('GATHERING_', '').toLowerCase();
|
||||
}
|
||||
|
||||
export function formatResourceName(resource: string): string {
|
||||
return resource.charAt(0).toUpperCase() + resource.slice(1);
|
||||
}
|
||||
Reference in New Issue
Block a user