@isdk/ai-tool 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/dist/chunk-VIG2GB47.mjs +39 -1
  2. package/dist/chunk-VJ45JQBR.mjs +7829 -0
  3. package/dist/funcs.d.mts +3 -2
  4. package/dist/funcs.d.ts +3 -2
  5. package/dist/funcs.js +5156 -1
  6. package/dist/funcs.mjs +29 -1
  7. package/dist/index-Br-4ZYgE.d.mts +892 -0
  8. package/dist/index-Br-4ZYgE.d.ts +892 -0
  9. package/dist/index.d.mts +206 -238
  10. package/dist/index.d.ts +206 -238
  11. package/dist/index.js +8132 -1
  12. package/dist/index.mjs +476 -1
  13. package/dist/test/util.js +101 -1
  14. package/dist/test/util.mjs +30 -1
  15. package/package.json +31 -31
  16. package/dist/chunk-JHHFTTVE.mjs +0 -1
  17. package/dist/index-BC3GQn6-.d.mts +0 -488
  18. package/dist/index-BC3GQn6-.d.ts +0 -488
  19. package/docs/README.md +0 -250
  20. package/docs/_media/CONTRIBUTING.md +0 -18
  21. package/docs/_media/LICENSE-MIT +0 -22
  22. package/docs/classes/AbortError.md +0 -368
  23. package/docs/classes/AlreadyExistsError.md +0 -348
  24. package/docs/classes/BaseError.md +0 -359
  25. package/docs/classes/CancelableAbility.md +0 -379
  26. package/docs/classes/ClientTools.md +0 -2691
  27. package/docs/classes/CommonError.md +0 -377
  28. package/docs/classes/ConfigFile.md +0 -333
  29. package/docs/classes/EventClient.md +0 -3119
  30. package/docs/classes/EventServer.md +0 -3149
  31. package/docs/classes/EventToolFunc.md +0 -2533
  32. package/docs/classes/FStringPromptTemplate.md +0 -1150
  33. package/docs/classes/FewShotPromptTemplate.md +0 -1186
  34. package/docs/classes/GolangPromptTemplate.md +0 -1150
  35. package/docs/classes/HFEnvironment.md +0 -186
  36. package/docs/classes/HFInterpreter.md +0 -75
  37. package/docs/classes/HFTemplate.md +0 -67
  38. package/docs/classes/HfPromptTemplate.md +0 -1150
  39. package/docs/classes/IntSet.md +0 -216
  40. package/docs/classes/NotFoundError.md +0 -348
  41. package/docs/classes/NotImplementationError.md +0 -348
  42. package/docs/classes/PromptExampleSelector.md +0 -195
  43. package/docs/classes/PromptTemplate.md +0 -1079
  44. package/docs/classes/ReadableStreamError.md +0 -368
  45. package/docs/classes/ResClientTools.md +0 -2399
  46. package/docs/classes/ResServerTools.md +0 -2385
  47. package/docs/classes/SSEChannel.md +0 -270
  48. package/docs/classes/Semaphore.md +0 -177
  49. package/docs/classes/ServerTools.md +0 -2609
  50. package/docs/classes/TaskAbortController.md +0 -137
  51. package/docs/classes/ToolFunc.md +0 -2147
  52. package/docs/classes/YamlTypeBaseObject.md +0 -29
  53. package/docs/enumerations/AsyncFeatureBits.md +0 -37
  54. package/docs/enumerations/AsyncFeatures.md +0 -37
  55. package/docs/enumerations/ErrorCode.md +0 -217
  56. package/docs/enumerations/HashAlgorithm.md +0 -117
  57. package/docs/functions/AIArgProcessor.md +0 -27
  58. package/docs/functions/AIStream.md +0 -50
  59. package/docs/functions/ChoiceArgProcessor.md +0 -27
  60. package/docs/functions/RateLimit.md +0 -33
  61. package/docs/functions/TemplateArgProcessor.md +0 -27
  62. package/docs/functions/backendEventable.md +0 -23
  63. package/docs/functions/canonicalize.md +0 -21
  64. package/docs/functions/completeSentences.md +0 -23
  65. package/docs/functions/concatText.md +0 -23
  66. package/docs/functions/countLLMTokens.md +0 -23
  67. package/docs/functions/countRegexMatches.md +0 -33
  68. package/docs/functions/createAbilityInjector.md +0 -87
  69. package/docs/functions/createCallbacksTransformer.md +0 -49
  70. package/docs/functions/createEmptyReadableStream.md +0 -23
  71. package/docs/functions/createEndWithRepetitionDetector.md +0 -29
  72. package/docs/functions/createError.md +0 -35
  73. package/docs/functions/createEventStreamTransformer.md +0 -33
  74. package/docs/functions/createHfValueFunc.md +0 -29
  75. package/docs/functions/createLRUCache.md +0 -23
  76. package/docs/functions/createYamlObjectTag.md +0 -23
  77. package/docs/functions/dateToText.md +0 -23
  78. package/docs/functions/decodeCharset.md +0 -23
  79. package/docs/functions/detectCharset.md +0 -23
  80. package/docs/functions/encodeLLMTokens.md +0 -23
  81. package/docs/functions/expandEnv.md +0 -40
  82. package/docs/functions/expandObjEnv.md +0 -54
  83. package/docs/functions/extNameLevel.md +0 -43
  84. package/docs/functions/fileIsExists.md +0 -34
  85. package/docs/functions/filenameReservedRegex.md +0 -22
  86. package/docs/functions/filterValidFnScope.md +0 -21
  87. package/docs/functions/findIndexNonEmptyFrom.md +0 -23
  88. package/docs/functions/findPort.md +0 -23
  89. package/docs/functions/formatISO.md +0 -71
  90. package/docs/functions/formatTextWithSpace.md +0 -59
  91. package/docs/functions/getAllEnumKeys.md +0 -31
  92. package/docs/functions/getConfigFileNames.md +0 -23
  93. package/docs/functions/getConfigs.md +0 -23
  94. package/docs/functions/getFileMetaInfo.md +0 -21
  95. package/docs/functions/getHashAlgoBySize.md +0 -21
  96. package/docs/functions/getKeysPath.md +0 -38
  97. package/docs/functions/getLLMTokenizer.md +0 -21
  98. package/docs/functions/getMultiLevelExtname.md +0 -31
  99. package/docs/functions/getPackageDir.md +0 -39
  100. package/docs/functions/getRealFilepath.md +0 -34
  101. package/docs/functions/getResponseErrorReadableStream.md +0 -21
  102. package/docs/functions/hasDirectoryIn.md +0 -38
  103. package/docs/functions/hashFile.md +0 -23
  104. package/docs/functions/hashStream.md +0 -23
  105. package/docs/functions/hfParse.md +0 -24
  106. package/docs/functions/hfTokenize.md +0 -25
  107. package/docs/functions/interpolateEnv.md +0 -25
  108. package/docs/functions/interpolateFString.md +0 -27
  109. package/docs/functions/interpolateGolangTemplate.md +0 -31
  110. package/docs/functions/isLangUsingSpaces.md +0 -21
  111. package/docs/functions/isListItemString.md +0 -21
  112. package/docs/functions/isModelNameMatched.md +0 -45
  113. package/docs/functions/isPunctuationChar.md +0 -36
  114. package/docs/functions/isRegExp.md +0 -21
  115. package/docs/functions/isSectionString.md +0 -23
  116. package/docs/functions/isSentenceEnding.md +0 -21
  117. package/docs/functions/isSepLineString.md +0 -21
  118. package/docs/functions/isSubdirectory.md +0 -39
  119. package/docs/functions/isTitleString.md +0 -23
  120. package/docs/functions/isValidFilename.md +0 -38
  121. package/docs/functions/isValidFilepath.md +0 -27
  122. package/docs/functions/isWebStream.md +0 -21
  123. package/docs/functions/jsonFilterToWhere.md +0 -45
  124. package/docs/functions/jsonToMarkdownStr.md +0 -31
  125. package/docs/functions/loadFileFromPaths.md +0 -54
  126. package/docs/functions/loadTextFromPaths.md +0 -29
  127. package/docs/functions/lrucache.md +0 -29
  128. package/docs/functions/makeToolFuncCancelable.md +0 -23
  129. package/docs/functions/matchUrlProtocol.md +0 -48
  130. package/docs/functions/memoize.md +0 -27
  131. package/docs/functions/messagesToText.md +0 -21
  132. package/docs/functions/paramsSizeToScaleStr.md +0 -32
  133. package/docs/functions/parseCommand.md +0 -33
  134. package/docs/functions/parseDateFormat.md +0 -360
  135. package/docs/functions/parseFString.md +0 -26
  136. package/docs/functions/parseISO.md +0 -72
  137. package/docs/functions/parseJsJson.md +0 -38
  138. package/docs/functions/parseJsJsonSimpleSync.md +0 -23
  139. package/docs/functions/parseObjectArgInfo.md +0 -27
  140. package/docs/functions/parseObjectArgumentInfos.md +0 -25
  141. package/docs/functions/parseObjectArguments.md +0 -68
  142. package/docs/functions/parseObjectArgumentsAsArgInfos.md +0 -42
  143. package/docs/functions/parseYaml.md +0 -21
  144. package/docs/functions/quoteStr.md +0 -21
  145. package/docs/functions/reControlCharsRegex.md +0 -21
  146. package/docs/functions/readFilenamesRecursiveSync.md +0 -47
  147. package/docs/functions/readTextFileChunks.md +0 -51
  148. package/docs/functions/readTextFileChunksEx.md +0 -23
  149. package/docs/functions/readableFromAsyncIterable.md +0 -28
  150. package/docs/functions/registerCoreTools.md +0 -17
  151. package/docs/functions/registerYamlTag.md +0 -21
  152. package/docs/functions/removeMarkdownBold.md +0 -23
  153. package/docs/functions/removeMarkdownBoldAndItalic.md +0 -23
  154. package/docs/functions/removeMarkdownItalic.md +0 -23
  155. package/docs/functions/replaceWithPlaceholder.md +0 -41
  156. package/docs/functions/restoreFromPlacehoders.md +0 -45
  157. package/docs/functions/sanitizeFilename.md +0 -37
  158. package/docs/functions/sanitizeFilepath.md +0 -31
  159. package/docs/functions/saveConfigFile.md +0 -25
  160. package/docs/functions/scaleStrToParamsSize.md +0 -27
  161. package/docs/functions/simplifyObjectArguments.md +0 -21
  162. package/docs/functions/sortedValues.md +0 -25
  163. package/docs/functions/splitChunks.md +0 -23
  164. package/docs/functions/splitParagraph.md +0 -32
  165. package/docs/functions/splitSentence.md +0 -37
  166. package/docs/functions/stringifyYaml.md +0 -21
  167. package/docs/functions/stripConsoleColor.md +0 -21
  168. package/docs/functions/textToDate.md +0 -23
  169. package/docs/functions/throwError.md +0 -37
  170. package/docs/functions/toDate.md +0 -76
  171. package/docs/functions/toDateTime.md +0 -21
  172. package/docs/functions/toRegExp.md +0 -34
  173. package/docs/functions/trimStartOfStreamHelper.md +0 -41
  174. package/docs/functions/truncTo.md +0 -47
  175. package/docs/functions/truncateByToken.md +0 -23
  176. package/docs/functions/truncateToTokenLimit.md +0 -44
  177. package/docs/functions/truncateToTokenLimitEx.md +0 -23
  178. package/docs/functions/uuid.md +0 -23
  179. package/docs/functions/uuidParse.md +0 -21
  180. package/docs/functions/uuidStringify.md +0 -23
  181. package/docs/functions/uuidValidate.md +0 -21
  182. package/docs/functions/uuidVersion.md +0 -21
  183. package/docs/functions/uuidv1.md +0 -47
  184. package/docs/functions/uuidv4.md +0 -47
  185. package/docs/functions/uuidv5.md +0 -51
  186. package/docs/functions/wait.md +0 -21
  187. package/docs/functions/xxhash.md +0 -25
  188. package/docs/functions/xxhash32.md +0 -23
  189. package/docs/functions/xxhash64.md +0 -23
  190. package/docs/functions/xxhashAsStr.md +0 -25
  191. package/docs/globals.md +0 -285
  192. package/docs/interfaces/AIChatAssistantMessageParam.md +0 -117
  193. package/docs/interfaces/AIChatContentPartImage.md +0 -31
  194. package/docs/interfaces/AIChatContentPartText.md +0 -27
  195. package/docs/interfaces/AIChatMessageParamBase.md +0 -58
  196. package/docs/interfaces/AIChatMessageToolCall.md +0 -45
  197. package/docs/interfaces/AIChatSystemMessageParam.md +0 -87
  198. package/docs/interfaces/AIChatToolMessageParam.md +0 -97
  199. package/docs/interfaces/AIChatUserMessageParam.md +0 -127
  200. package/docs/interfaces/AIChoiceConfig.md +0 -77
  201. package/docs/interfaces/AIResult.md +0 -73
  202. package/docs/interfaces/AIStreamParser.md +0 -39
  203. package/docs/interfaces/AIStreamParserOptions.md +0 -21
  204. package/docs/interfaces/BaseFunc.md +0 -155
  205. package/docs/interfaces/BaseFuncItem.md +0 -103
  206. package/docs/interfaces/CancelableAbilityOptions.md +0 -115
  207. package/docs/interfaces/ClientFuncItem.md +0 -179
  208. package/docs/interfaces/DotenvExpandOptions.md +0 -47
  209. package/docs/interfaces/DotenvExpandOutput.md +0 -27
  210. package/docs/interfaces/DotenvParseInput.md +0 -11
  211. package/docs/interfaces/DotenvParseOutput.md +0 -11
  212. package/docs/interfaces/DotenvPopulateInput.md +0 -11
  213. package/docs/interfaces/EventClientFuncParams.md +0 -55
  214. package/docs/interfaces/EventServerFuncParams.md +0 -71
  215. package/docs/interfaces/FewShotPromptTemplateOptions.md +0 -163
  216. package/docs/interfaces/FuncItem.md +0 -143
  217. package/docs/interfaces/FuncParam.md +0 -71
  218. package/docs/interfaces/FuncParams.md +0 -11
  219. package/docs/interfaces/Funcs.md +0 -11
  220. package/docs/interfaces/HashAlgoParams.md +0 -37
  221. package/docs/interfaces/IFileMetaInfo.md +0 -77
  222. package/docs/interfaces/IReadTextFileChunksOptions.md +0 -157
  223. package/docs/interfaces/ITruncateToTokenLimitOptions.md +0 -111
  224. package/docs/interfaces/JsonFilter.md +0 -11
  225. package/docs/interfaces/ParseObjectArgumentOptions.md +0 -97
  226. package/docs/interfaces/PromptExampleSelectorOptions.md +0 -36
  227. package/docs/interfaces/PromptTemplateOptions.md +0 -75
  228. package/docs/interfaces/RemoteFuncItem.md +0 -168
  229. package/docs/interfaces/ReplacePlacehoderOptions.md +0 -47
  230. package/docs/interfaces/ResClientFuncParams.md +0 -35
  231. package/docs/interfaces/ResServerFuncParams.md +0 -73
  232. package/docs/interfaces/SanitizeFilenameOptions.md +0 -27
  233. package/docs/interfaces/SectionStringOptions.md +0 -27
  234. package/docs/interfaces/ServerFuncItem.md +0 -189
  235. package/docs/interfaces/ServerFuncParams.md +0 -37
  236. package/docs/interfaces/SplitSentenceOptions.md +0 -47
  237. package/docs/interfaces/StreamCallbacksAndOptions.md +0 -95
  238. package/docs/interfaces/TaskAbortControllers.md +0 -11
  239. package/docs/interfaces/TaskPromise.md +0 -138
  240. package/docs/interfaces/ToolFuncPackage.md +0 -49
  241. package/docs/type-aliases/AIChatContentPart.md +0 -13
  242. package/docs/type-aliases/AIChatMessageParam.md +0 -13
  243. package/docs/type-aliases/AIChatRole.md +0 -13
  244. package/docs/type-aliases/AIMessageType.md +0 -13
  245. package/docs/type-aliases/AIModelNameRule.md +0 -13
  246. package/docs/type-aliases/AIModelNameRuleFn.md +0 -21
  247. package/docs/type-aliases/AIModelNameRules.md +0 -13
  248. package/docs/type-aliases/AITextGenerationFinishReason.md +0 -13
  249. package/docs/type-aliases/ActionName.md +0 -13
  250. package/docs/type-aliases/AsyncTaskId.md +0 -13
  251. package/docs/type-aliases/EventErrorListenerFn.md +0 -27
  252. package/docs/type-aliases/EventListenerFn.md +0 -25
  253. package/docs/type-aliases/FStringPromptTemplateNode.md +0 -16
  254. package/docs/type-aliases/FuncParamType.md +0 -13
  255. package/docs/type-aliases/PromptExamples.md +0 -17
  256. package/docs/type-aliases/PromptTemplateType.md +0 -13
  257. package/docs/type-aliases/PromptType.md +0 -13
  258. package/docs/type-aliases/TFunc.md +0 -23
  259. package/docs/variables/AIChatRoles.md +0 -13
  260. package/docs/variables/AIMessageTypes.md +0 -13
  261. package/docs/variables/AITextGenerationFinishReasons.md +0 -13
  262. package/docs/variables/AbortErrorCode.md +0 -13
  263. package/docs/variables/ActionNames.md +0 -13
  264. package/docs/variables/AlreadyExistsErrorCode.md +0 -13
  265. package/docs/variables/ClientToolFuncSchema.md +0 -87
  266. package/docs/variables/DefaultAsyncSemaphoreCapacity.md +0 -13
  267. package/docs/variables/EventBusName.md +0 -13
  268. package/docs/variables/EventName.md +0 -13
  269. package/docs/variables/FilenameReservedRegex.md +0 -16
  270. package/docs/variables/HFBuiltins.md +0 -92
  271. package/docs/variables/InternalErrorCode.md +0 -13
  272. package/docs/variables/LLM_TOKENIZER_NAMES.md +0 -83
  273. package/docs/variables/LLM_TOKENIZER_NAMES_MAP.md +0 -13
  274. package/docs/variables/NotFoundErrorCode.md +0 -13
  275. package/docs/variables/NotImplementedErrorCode.md +0 -13
  276. package/docs/variables/PASSING_SCORE.md +0 -13
  277. package/docs/variables/PromptTemplateTypes.md +0 -13
  278. package/docs/variables/PromptTypes.md +0 -16
  279. package/docs/variables/RStreamErrCode.md +0 -13
  280. package/docs/variables/RemoteToolFuncSchema.md +0 -87
  281. package/docs/variables/ResponseRStreamErrCode.md +0 -13
  282. package/docs/variables/SSEChannelAlreadyClosedErrCode.md +0 -13
  283. package/docs/variables/ServerToolFuncSchema.md +0 -87
  284. package/docs/variables/ToolAsyncCancelableBit.md +0 -13
  285. package/docs/variables/ToolAsyncMultiTaskBit.md +0 -13
  286. package/docs/variables/ToolAsyncPriorityBit.md +0 -13
  287. package/docs/variables/ToolFuncSchema.md +0 -125
  288. package/docs/variables/WindowsReservedNameRegex.md +0 -15
  289. package/docs/variables/base32768.md +0 -13
  290. package/docs/variables/defaultTemplateFormat.md +0 -13
  291. package/docs/variables/event.md +0 -13
  292. package/docs/variables/eventClient.md +0 -13
  293. package/docs/variables/eventServer.md +0 -13
  294. package/docs/variables/lrucache.md +0 -13
  295. package/docs/variables/mimeType.md +0 -13
  296. package/docs/variables/uuidNIL.md +0 -13
@@ -1,48 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / matchUrlProtocol
6
-
7
- # Function: matchUrlProtocol()
8
-
9
- > **matchUrlProtocol**(`name`): `undefined` \| `string`
10
-
11
- Extracts the protocol part from a URL-like string.
12
-
13
- This function checks a given string to find the protocol section of a URL.
14
- If the string contains the sequence '://', it returns the substring from the start of the string
15
- up to the '//' characters. If the sequence is not found, the function returns undefined.
16
-
17
- ## Parameters
18
-
19
- • **name**: `string`
20
-
21
- The string to inspect, expected to contain a URL.
22
-
23
- ## Returns
24
-
25
- `undefined` \| `string`
26
-
27
- - The protocol part if '://' is found; otherwise, undefined.
28
-
29
- ## Examples
30
-
31
- ```ts
32
- // Returns "http"
33
- matchUrlProtocol("http://example.com");
34
- ```
35
-
36
- ```ts
37
- // Returns "ftp"
38
- matchUrlProtocol("ftp://myftpserver.com");
39
- ```
40
-
41
- ```ts
42
- // Returns undefined
43
- matchUrlProtocol("noProtocolHere");
44
- ```
45
-
46
- ## Defined in
47
-
48
- [packages/ai-tool/src/utils/match-url-protocol.ts:23](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/match-url-protocol.ts#L23)
@@ -1,27 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / memoize
6
-
7
- # Function: memoize()
8
-
9
- > **memoize**\<`F`\>(`fn`, `options`?): `F` & `Memoized`\<`F`\>
10
-
11
- ## Type Parameters
12
-
13
- • **F** *extends* (...`args`) => `any`
14
-
15
- ## Parameters
16
-
17
- • **fn**: `any`
18
-
19
- • **options?**: `Options`\<`F`\>
20
-
21
- ## Returns
22
-
23
- `F` & `Memoized`\<`F`\>
24
-
25
- ## Defined in
26
-
27
- [packages/ai-tool/src/utils/memoize.ts:14](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/memoize.ts#L14)
@@ -1,21 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / messagesToText
6
-
7
- # Function: messagesToText()
8
-
9
- > **messagesToText**(`messages`): `string`
10
-
11
- ## Parameters
12
-
13
- • **messages**: [`AIChatMessageParamBase`](../interfaces/AIChatMessageParamBase.md)[]
14
-
15
- ## Returns
16
-
17
- `string`
18
-
19
- ## Defined in
20
-
21
- [packages/ai-tool/src/utils/chat.ts:121](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/chat.ts#L121)
@@ -1,32 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / paramsSizeToScaleStr
6
-
7
- # Function: paramsSizeToScaleStr()
8
-
9
- > **paramsSizeToScaleStr**(`paramsSize`, `fractionDigits`): `string`
10
-
11
- Formats a parameter size in bytes into a string with an appropriate scale (T, B, M, or K),
12
- optionally specifying the number of fractional digits to display.
13
-
14
- ## Parameters
15
-
16
- • **paramsSize**: `number`
17
-
18
- The parameter size in bytes.
19
-
20
- • **fractionDigits**: `number` = `0`
21
-
22
- The number of fractional digits to include in the formatted output. Default is 0 (no fractional digits).
23
-
24
- ## Returns
25
-
26
- `string`
27
-
28
- A string representing the formatted parameter size with the appropriate scale unit and the specified number of fractional digits.
29
-
30
- ## Defined in
31
-
32
- [packages/ai-tool/src/utils/convert-params-size.ts:11](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/convert-params-size.ts#L11)
@@ -1,33 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / parseCommand
6
-
7
- # Function: parseCommand()
8
-
9
- > **parseCommand**(`commandStr`, `scope`?, `options`?): `Promise`\<`object`\>
10
-
11
- ## Parameters
12
-
13
- • **commandStr**: `string`
14
-
15
- • **scope?**: `Record`\<`string`, `any`\>
16
-
17
- • **options?**: [`ParseObjectArgumentOptions`](../interfaces/ParseObjectArgumentOptions.md)
18
-
19
- ## Returns
20
-
21
- `Promise`\<`object`\>
22
-
23
- ### args?
24
-
25
- > `optional` **args**: `Record`\<`string`, `any`\>
26
-
27
- ### command
28
-
29
- > **command**: `string`
30
-
31
- ## Defined in
32
-
33
- [packages/ai-tool/src/utils/parse-command.ts:396](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/parse-command.ts#L396)
@@ -1,360 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / parseDateFormat
6
-
7
- # Function: parseDateFormat()
8
-
9
- > **parseDateFormat**\<`DateType`, `ResultDate`\>(`dateStr`, `formatStr`, `referenceDate`, `options`?): `ResultDate`
10
-
11
- ## Type Parameters
12
-
13
- • **DateType** *extends* `Date`
14
-
15
- The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
16
-
17
- • **ResultDate** *extends* `Date` = `DateType`
18
-
19
- The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
20
-
21
- ## Parameters
22
-
23
- • **dateStr**: `string`
24
-
25
- The string to parse
26
-
27
- • **formatStr**: `string`
28
-
29
- The string of tokens
30
-
31
- • **referenceDate**: `DateArg`\<`DateType`\>
32
-
33
- defines values missing from the parsed dateString
34
-
35
- • **options?**: `ParseOptions`\<`ResultDate`\>
36
-
37
- An object with options.
38
- see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
39
- see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
40
-
41
- ## Returns
42
-
43
- `ResultDate`
44
-
45
- The parsed date
46
-
47
- ## Name
48
-
49
- parse
50
-
51
- ## Summary
52
-
53
- Parse the date.
54
-
55
- ## Description
56
-
57
- Return the date parsed from string using the given format string.
58
-
59
- > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.
60
- > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
61
-
62
- The characters in the format string wrapped between two single quotes characters (') are escaped.
63
- Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.
64
-
65
- Format of the format string is based on Unicode Technical Standard #35:
66
- https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
67
- with a few additions (see note 5 below the table).
68
-
69
- Not all tokens are compatible. Combinations that don't make sense or could lead to bugs are prohibited
70
- and will throw `RangeError`. For example usage of 24-hour format token with AM/PM token will throw an exception:
71
-
72
- ```javascript
73
- parse('23 AM', 'HH a', new Date())
74
- //=> RangeError: The format string mustn't contain `HH` and `a` at the same time
75
- ```
76
-
77
- See the compatibility table: https://docs.google.com/spreadsheets/d/e/2PACX-1vQOPU3xUhplll6dyoMmVUXHKl_8CRDs6_ueLmex3SoqwhuolkuN3O05l4rqx5h1dKX8eb46Ul-CCSrq/pubhtml?gid=0&single=true
78
-
79
- Accepted format string patterns:
80
- | Unit |Prior| Pattern | Result examples | Notes |
81
- |---------------------------------|-----|---------|-----------------------------------|-------|
82
- | Era | 140 | G..GGG | AD, BC | |
83
- | | | GGGG | Anno Domini, Before Christ | 2 |
84
- | | | GGGGG | A, B | |
85
- | Calendar year | 130 | y | 44, 1, 1900, 2017, 9999 | 4 |
86
- | | | yo | 44th, 1st, 1900th, 9999999th | 4,5 |
87
- | | | yy | 44, 01, 00, 17 | 4 |
88
- | | | yyy | 044, 001, 123, 999 | 4 |
89
- | | | yyyy | 0044, 0001, 1900, 2017 | 4 |
90
- | | | yyyyy | ... | 2,4 |
91
- | Local week-numbering year | 130 | Y | 44, 1, 1900, 2017, 9000 | 4 |
92
- | | | Yo | 44th, 1st, 1900th, 9999999th | 4,5 |
93
- | | | YY | 44, 01, 00, 17 | 4,6 |
94
- | | | YYY | 044, 001, 123, 999 | 4 |
95
- | | | YYYY | 0044, 0001, 1900, 2017 | 4,6 |
96
- | | | YYYYY | ... | 2,4 |
97
- | ISO week-numbering year | 130 | R | -43, 1, 1900, 2017, 9999, -9999 | 4,5 |
98
- | | | RR | -43, 01, 00, 17 | 4,5 |
99
- | | | RRR | -043, 001, 123, 999, -999 | 4,5 |
100
- | | | RRRR | -0043, 0001, 2017, 9999, -9999 | 4,5 |
101
- | | | RRRRR | ... | 2,4,5 |
102
- | Extended year | 130 | u | -43, 1, 1900, 2017, 9999, -999 | 4 |
103
- | | | uu | -43, 01, 99, -99 | 4 |
104
- | | | uuu | -043, 001, 123, 999, -999 | 4 |
105
- | | | uuuu | -0043, 0001, 2017, 9999, -9999 | 4 |
106
- | | | uuuuu | ... | 2,4 |
107
- | Quarter (formatting) | 120 | Q | 1, 2, 3, 4 | |
108
- | | | Qo | 1st, 2nd, 3rd, 4th | 5 |
109
- | | | QQ | 01, 02, 03, 04 | |
110
- | | | QQQ | Q1, Q2, Q3, Q4 | |
111
- | | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |
112
- | | | QQQQQ | 1, 2, 3, 4 | 4 |
113
- | Quarter (stand-alone) | 120 | q | 1, 2, 3, 4 | |
114
- | | | qo | 1st, 2nd, 3rd, 4th | 5 |
115
- | | | qq | 01, 02, 03, 04 | |
116
- | | | qqq | Q1, Q2, Q3, Q4 | |
117
- | | | qqqq | 1st quarter, 2nd quarter, ... | 2 |
118
- | | | qqqqq | 1, 2, 3, 4 | 3 |
119
- | Month (formatting) | 110 | M | 1, 2, ..., 12 | |
120
- | | | Mo | 1st, 2nd, ..., 12th | 5 |
121
- | | | MM | 01, 02, ..., 12 | |
122
- | | | MMM | Jan, Feb, ..., Dec | |
123
- | | | MMMM | January, February, ..., December | 2 |
124
- | | | MMMMM | J, F, ..., D | |
125
- | Month (stand-alone) | 110 | L | 1, 2, ..., 12 | |
126
- | | | Lo | 1st, 2nd, ..., 12th | 5 |
127
- | | | LL | 01, 02, ..., 12 | |
128
- | | | LLL | Jan, Feb, ..., Dec | |
129
- | | | LLLL | January, February, ..., December | 2 |
130
- | | | LLLLL | J, F, ..., D | |
131
- | Local week of year | 100 | w | 1, 2, ..., 53 | |
132
- | | | wo | 1st, 2nd, ..., 53th | 5 |
133
- | | | ww | 01, 02, ..., 53 | |
134
- | ISO week of year | 100 | I | 1, 2, ..., 53 | 5 |
135
- | | | Io | 1st, 2nd, ..., 53th | 5 |
136
- | | | II | 01, 02, ..., 53 | 5 |
137
- | Day of month | 90 | d | 1, 2, ..., 31 | |
138
- | | | do | 1st, 2nd, ..., 31st | 5 |
139
- | | | dd | 01, 02, ..., 31 | |
140
- | Day of year | 90 | D | 1, 2, ..., 365, 366 | 7 |
141
- | | | Do | 1st, 2nd, ..., 365th, 366th | 5 |
142
- | | | DD | 01, 02, ..., 365, 366 | 7 |
143
- | | | DDD | 001, 002, ..., 365, 366 | |
144
- | | | DDDD | ... | 2 |
145
- | Day of week (formatting) | 90 | E..EEE | Mon, Tue, Wed, ..., Sun | |
146
- | | | EEEE | Monday, Tuesday, ..., Sunday | 2 |
147
- | | | EEEEE | M, T, W, T, F, S, S | |
148
- | | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |
149
- | ISO day of week (formatting) | 90 | i | 1, 2, 3, ..., 7 | 5 |
150
- | | | io | 1st, 2nd, ..., 7th | 5 |
151
- | | | ii | 01, 02, ..., 07 | 5 |
152
- | | | iii | Mon, Tue, Wed, ..., Sun | 5 |
153
- | | | iiii | Monday, Tuesday, ..., Sunday | 2,5 |
154
- | | | iiiii | M, T, W, T, F, S, S | 5 |
155
- | | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 5 |
156
- | Local day of week (formatting) | 90 | e | 2, 3, 4, ..., 1 | |
157
- | | | eo | 2nd, 3rd, ..., 1st | 5 |
158
- | | | ee | 02, 03, ..., 01 | |
159
- | | | eee | Mon, Tue, Wed, ..., Sun | |
160
- | | | eeee | Monday, Tuesday, ..., Sunday | 2 |
161
- | | | eeeee | M, T, W, T, F, S, S | |
162
- | | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |
163
- | Local day of week (stand-alone) | 90 | c | 2, 3, 4, ..., 1 | |
164
- | | | co | 2nd, 3rd, ..., 1st | 5 |
165
- | | | cc | 02, 03, ..., 01 | |
166
- | | | ccc | Mon, Tue, Wed, ..., Sun | |
167
- | | | cccc | Monday, Tuesday, ..., Sunday | 2 |
168
- | | | ccccc | M, T, W, T, F, S, S | |
169
- | | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |
170
- | AM, PM | 80 | a..aaa | AM, PM | |
171
- | | | aaaa | a.m., p.m. | 2 |
172
- | | | aaaaa | a, p | |
173
- | AM, PM, noon, midnight | 80 | b..bbb | AM, PM, noon, midnight | |
174
- | | | bbbb | a.m., p.m., noon, midnight | 2 |
175
- | | | bbbbb | a, p, n, mi | |
176
- | Flexible day period | 80 | B..BBB | at night, in the morning, ... | |
177
- | | | BBBB | at night, in the morning, ... | 2 |
178
- | | | BBBBB | at night, in the morning, ... | |
179
- | Hour [1-12] | 70 | h | 1, 2, ..., 11, 12 | |
180
- | | | ho | 1st, 2nd, ..., 11th, 12th | 5 |
181
- | | | hh | 01, 02, ..., 11, 12 | |
182
- | Hour [0-23] | 70 | H | 0, 1, 2, ..., 23 | |
183
- | | | Ho | 0th, 1st, 2nd, ..., 23rd | 5 |
184
- | | | HH | 00, 01, 02, ..., 23 | |
185
- | Hour [0-11] | 70 | K | 1, 2, ..., 11, 0 | |
186
- | | | Ko | 1st, 2nd, ..., 11th, 0th | 5 |
187
- | | | KK | 01, 02, ..., 11, 00 | |
188
- | Hour [1-24] | 70 | k | 24, 1, 2, ..., 23 | |
189
- | | | ko | 24th, 1st, 2nd, ..., 23rd | 5 |
190
- | | | kk | 24, 01, 02, ..., 23 | |
191
- | Minute | 60 | m | 0, 1, ..., 59 | |
192
- | | | mo | 0th, 1st, ..., 59th | 5 |
193
- | | | mm | 00, 01, ..., 59 | |
194
- | Second | 50 | s | 0, 1, ..., 59 | |
195
- | | | so | 0th, 1st, ..., 59th | 5 |
196
- | | | ss | 00, 01, ..., 59 | |
197
- | Seconds timestamp | 40 | t | 512969520 | |
198
- | | | tt | ... | 2 |
199
- | Fraction of second | 30 | S | 0, 1, ..., 9 | |
200
- | | | SS | 00, 01, ..., 99 | |
201
- | | | SSS | 000, 001, ..., 999 | |
202
- | | | SSSS | ... | 2 |
203
- | Milliseconds timestamp | 20 | T | 512969520900 | |
204
- | | | TT | ... | 2 |
205
- | Timezone (ISO-8601 w/ Z) | 10 | X | -08, +0530, Z | |
206
- | | | XX | -0800, +0530, Z | |
207
- | | | XXX | -08:00, +05:30, Z | |
208
- | | | XXXX | -0800, +0530, Z, +123456 | 2 |
209
- | | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |
210
- | Timezone (ISO-8601 w/o Z) | 10 | x | -08, +0530, +00 | |
211
- | | | xx | -0800, +0530, +0000 | |
212
- | | | xxx | -08:00, +05:30, +00:00 | 2 |
213
- | | | xxxx | -0800, +0530, +0000, +123456 | |
214
- | | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |
215
- | Long localized date | NA | P | 05/29/1453 | 5,8 |
216
- | | | PP | May 29, 1453 | |
217
- | | | PPP | May 29th, 1453 | |
218
- | | | PPPP | Sunday, May 29th, 1453 | 2,5,8 |
219
- | Long localized time | NA | p | 12:00 AM | 5,8 |
220
- | | | pp | 12:00:00 AM | |
221
- | Combination of date and time | NA | Pp | 05/29/1453, 12:00 AM | |
222
- | | | PPpp | May 29, 1453, 12:00:00 AM | |
223
- | | | PPPpp | May 29th, 1453 at ... | |
224
- | | | PPPPpp | Sunday, May 29th, 1453 at ... | 2,5,8 |
225
- Notes:
226
- 1. "Formatting" units (e.g. formatting quarter) in the default en-US locale
227
- are the same as "stand-alone" units, but are different in some languages.
228
- "Formatting" units are declined according to the rules of the language
229
- in the context of a date. "Stand-alone" units are always nominative singular.
230
- In `format` function, they will produce different result:
231
-
232
- `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`
233
-
234
- `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`
235
-
236
- `parse` will try to match both formatting and stand-alone units interchangeably.
237
-
238
- 2. Any sequence of the identical letters is a pattern, unless it is escaped by
239
- the single quote characters (see below).
240
- If the sequence is longer than listed in table:
241
- - for numerical units (`yyyyyyyy`) `parse` will try to match a number
242
- as wide as the sequence
243
- - for text units (`MMMMMMMM`) `parse` will try to match the widest variation of the unit.
244
- These variations are marked with "2" in the last column of the table.
245
-
246
- 3. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.
247
- These tokens represent the shortest form of the quarter.
248
-
249
- 4. The main difference between `y` and `u` patterns are B.C. years:
250
-
251
- | Year | `y` | `u` |
252
- |------|-----|-----|
253
- | AC 1 | 1 | 1 |
254
- | BC 1 | 1 | 0 |
255
- | BC 2 | 2 | -1 |
256
-
257
- Also `yy` will try to guess the century of two digit year by proximity with `referenceDate`:
258
-
259
- `parse('50', 'yy', new Date(2018, 0, 1)) //=> Sat Jan 01 2050 00:00:00`
260
-
261
- `parse('75', 'yy', new Date(2018, 0, 1)) //=> Wed Jan 01 1975 00:00:00`
262
-
263
- while `uu` will just assign the year as is:
264
-
265
- `parse('50', 'uu', new Date(2018, 0, 1)) //=> Sat Jan 01 0050 00:00:00`
266
-
267
- `parse('75', 'uu', new Date(2018, 0, 1)) //=> Tue Jan 01 0075 00:00:00`
268
-
269
- The same difference is true for local and ISO week-numbering years (`Y` and `R`),
270
- except local week-numbering years are dependent on `options.weekStartsOn`
271
- and `options.firstWeekContainsDate` (compare [setISOWeekYear](https://date-fns.org/docs/setISOWeekYear)
272
- and [setWeekYear](https://date-fns.org/docs/setWeekYear)).
273
-
274
- 5. These patterns are not in the Unicode Technical Standard #35:
275
- - `i`: ISO day of week
276
- - `I`: ISO week of year
277
- - `R`: ISO week-numbering year
278
- - `o`: ordinal number modifier
279
- - `P`: long localized date
280
- - `p`: long localized time
281
-
282
- 6. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.
283
- You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
284
-
285
- 7. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.
286
- You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
287
-
288
- 8. `P+` tokens do not have a defined priority since they are merely aliases to other tokens based
289
- on the given locale.
290
-
291
- using `en-US` locale: `P` => `MM/dd/yyyy`
292
- using `en-US` locale: `p` => `hh:mm a`
293
- using `pt-BR` locale: `P` => `dd/MM/yyyy`
294
- using `pt-BR` locale: `p` => `HH:mm`
295
-
296
- Values will be assigned to the date in the descending order of its unit's priority.
297
- Units of an equal priority overwrite each other in the order of appearance.
298
-
299
- If no values of higher priority are parsed (e.g. when parsing string 'January 1st' without a year),
300
- the values will be taken from 3rd argument `referenceDate` which works as a context of parsing.
301
-
302
- `referenceDate` must be passed for correct work of the function.
303
- If you're not sure which `referenceDate` to supply, create a new instance of Date:
304
- `parse('02/11/2014', 'MM/dd/yyyy', new Date())`
305
- In this case parsing will be done in the context of the current date.
306
- If `referenceDate` is `Invalid Date` or a value not convertible to valid `Date`,
307
- then `Invalid Date` will be returned.
308
-
309
- The result may vary by locale.
310
-
311
- If `formatString` matches with `dateString` but does not provides tokens, `referenceDate` will be returned.
312
-
313
- If parsing failed, `Invalid Date` will be returned.
314
- Invalid Date is a Date, whose time value is NaN.
315
- Time value of Date: http://es5.github.io/#x15.9.1.1
316
-
317
- ## Throws
318
-
319
- `options.locale` must contain `match` property
320
-
321
- ## Throws
322
-
323
- use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
324
-
325
- ## Throws
326
-
327
- use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
328
-
329
- ## Throws
330
-
331
- use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
332
-
333
- ## Throws
334
-
335
- use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md
336
-
337
- ## Throws
338
-
339
- format string contains an unescaped latin alphabet character
340
-
341
- ## Examples
342
-
343
- ```ts
344
- // Parse 11 February 2014 from middle-endian format:
345
- var result = parse('02/11/2014', 'MM/dd/yyyy', new Date())
346
- //=> Tue Feb 11 2014 00:00:00
347
- ```
348
-
349
- ```ts
350
- // Parse 28th of February in Esperanto locale in the context of 2010 year:
351
- import eo from 'date-fns/locale/eo'
352
- var result = parse('28-a de februaro', "do 'de' MMMM", new Date(2010, 0, 1), {
353
- locale: eo
354
- })
355
- //=> Sun Feb 28 2010 00:00:00
356
- ```
357
-
358
- ## Defined in
359
-
360
- node\_modules/.pnpm/date-fns@4.1.0/node\_modules/date-fns/parse.d.ts:319
@@ -1,26 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / parseFString
6
-
7
- # Function: parseFString()
8
-
9
- > **parseFString**(`template`): [`FStringPromptTemplateNode`](../type-aliases/FStringPromptTemplateNode.md)[]
10
-
11
- Type that represents a function that takes a template string and
12
- returns an array of `ParsedFStringNode`.
13
-
14
- extract from langchain.js/langchain-core/src/prompts/template.ts
15
-
16
- ## Parameters
17
-
18
- • **template**: `string`
19
-
20
- ## Returns
21
-
22
- [`FStringPromptTemplateNode`](../type-aliases/FStringPromptTemplateNode.md)[]
23
-
24
- ## Defined in
25
-
26
- [packages/ai-tool/src/utils/prompt/template/python.ts:16](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/prompt/template/python.ts#L16)
@@ -1,72 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / parseISO
6
-
7
- # Function: parseISO()
8
-
9
- > **parseISO**\<`DateType`, `ResultDate`\>(`argument`, `options`?): `ResultDate`
10
-
11
- ## Type Parameters
12
-
13
- • **DateType** *extends* `Date`
14
-
15
- The `Date` type, the function operates on. Gets inferred from passed arguments. Allows to use extensions like [`UTCDate`](https://github.com/date-fns/utc).
16
-
17
- • **ResultDate** *extends* `Date` = `DateType`
18
-
19
- The result `Date` type, it is the type returned from the context function if it is passed, or inferred from the arguments.
20
-
21
- ## Parameters
22
-
23
- • **argument**: `string`
24
-
25
- The value to convert
26
-
27
- • **options?**: `ParseISOOptions`\<`ResultDate`\>
28
-
29
- An object with options
30
-
31
- ## Returns
32
-
33
- `ResultDate`
34
-
35
- The parsed date in the local time zone
36
-
37
- ## Name
38
-
39
- parseISO
40
-
41
- ## Summary
42
-
43
- Parse ISO string
44
-
45
- ## Description
46
-
47
- Parse the given string in ISO 8601 format and return an instance of Date.
48
-
49
- Function accepts complete ISO 8601 formats as well as partial implementations.
50
- ISO 8601: http://en.wikipedia.org/wiki/ISO_8601
51
-
52
- If the argument isn't a string, the function cannot parse the string or
53
- the values are invalid, it returns Invalid Date.
54
-
55
- ## Examples
56
-
57
- ```ts
58
- // Convert string '2014-02-11T11:30:30' to date:
59
- const result = parseISO('2014-02-11T11:30:30')
60
- //=> Tue Feb 11 2014 11:30:30
61
- ```
62
-
63
- ```ts
64
- // Convert string '+02014101' to date,
65
- // if the additional number of digits in the extended year format is 1:
66
- const result = parseISO('+02014101', { additionalDigits: 1 })
67
- //=> Fri Apr 11 2014 00:00:00
68
- ```
69
-
70
- ## Defined in
71
-
72
- node\_modules/.pnpm/date-fns@4.1.0/node\_modules/date-fns/parseISO.d.ts:43
@@ -1,38 +0,0 @@
1
- [**@isdk/ai-tool**](../README.md) • **Docs**
2
-
3
- ***
4
-
5
- [@isdk/ai-tool](../globals.md) / parseJsJson
6
-
7
- # Function: parseJsJson()
8
-
9
- > **parseJsJson**(`input`, `scope`?): `Promise`\<`any`\>
10
-
11
- Parses a JavaScript string into a JSON object.
12
-
13
- ## Parameters
14
-
15
- • **input**: `string`
16
-
17
- The string to be parsed into JSON.
18
-
19
- • **scope?**: `Record`\<`string`, `any`\>
20
-
21
- ## Returns
22
-
23
- `Promise`\<`any`\>
24
-
25
- The parsed JSON object. If parsing fails, undefined is returned.
26
-
27
- ## Example
28
-
29
- ```ts
30
- // This will return a JSON object with key 'name' and value 'John'.
31
- const jsonString = '({name: "John"})';
32
- const json = parseJsJson(jsonString);
33
- console.log(json); // { name: 'John' }
34
- ```
35
-
36
- ## Defined in
37
-
38
- [packages/ai-tool/src/utils/parse-js-json.ts:16](https://github.com/isdk/ai-tool.js/blob/e324043799402aa2caa41711a9168487ab85c166/src/utils/parse-js-json.ts#L16)