agsamantha/node_modules/langsmith/dist/utils/_uuid.js

11 lines
284 B
JavaScript
Raw Normal View History

2024-10-02 15:15:21 -05:00
import * as uuid from "uuid";
export function assertUuid(str, which) {
if (!uuid.validate(str)) {
const msg = which !== undefined
? `Invalid UUID for ${which}: ${str}`
: `Invalid UUID: ${str}`;
throw new Error(msg);
}
return str;
}