mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-27 05:41:23 +00:00
refactor: consolidate utility functions into shared package
Move duplicate isObject, asString, asNumber, and safeStringify functions from multiple modules into a centralized shared/src/utils.ts module and update imports across cli, server, and web packages. This eliminates code duplication and improves maintainability.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { isObject } from '@hapi/protocol'
|
||||
|
||||
export type AskUserQuestionOption = {
|
||||
label: string
|
||||
description: string | null
|
||||
@@ -15,10 +17,6 @@ export type AskUserQuestionQuestionInfo = {
|
||||
question: string | null
|
||||
}
|
||||
|
||||
function isObject(value: unknown): value is Record<string, unknown> {
|
||||
return Boolean(value) && typeof value === 'object'
|
||||
}
|
||||
|
||||
export function isAskUserQuestionToolName(toolName: string): boolean {
|
||||
return toolName === 'AskUserQuestion' || toolName === 'ask_user_question'
|
||||
}
|
||||
@@ -77,4 +75,3 @@ export function extractAskUserQuestionQuestionsInfo(input: unknown): AskUserQues
|
||||
}
|
||||
return questions
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user