agsamantha/node_modules/langsmith/dist/utils/_uuid.js
2024-10-02 15:15:21 -05:00

10 lines
284 B
JavaScript

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;
}