UNPKG
genpower
Version:
latest (1.1.0)
1.1.0
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
Unified TypeScript library to generate, validate, and structure AI model outputs
genpower
/
dist
/
utils.js
8 lines
(7 loc)
•
251 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
"use strict"
;
Object
.
defineProperty
(
exports
,
"__esModule"
, {
value
:
true
});
exports
.
extractJSON
= extractJSON;
function
extractJSON
(
text
) {
const
match = text.
match
(
/```json\s*([\s\S]*?)```/i
);
return
match ? match[
1
].
trim
() : text.
trim
(); }