Skip to content

Commit

Permalink
fix(javaascript): add conf input to validate api and set to null if n…
Browse files Browse the repository at this point in the history
…othing is given in input
  • Loading branch information
matteo-cristino authored and jaromil committed May 13, 2024
1 parent d048580 commit 4f37f56
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions bindings/javascript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,15 @@ export const introspect = async (zencode, props?: ZenroomProps) => {

export const zencode_valid_code = async (
zencode: string,
conf: string | null = null,
strict: number = 1
): Promise<ZenroomResult> => {
const Module = await getModule();
return new Promise((resolve, reject) => {
let result = "";
let logs = "";
const _exec = Module.cwrap("zencode_valid_code", "number", [
"string",
"string",
"number",
]);
Expand All @@ -238,12 +240,13 @@ export const zencode_valid_code = async (
Module.onAbort = () => {
reject({ result, logs });
};
_exec(zencode, strict);
_exec(zencode, conf, strict);
});
}

export const safe_zencode_valid_code = async (
zencode: string
zencode: string,
conf: string | null = null
): Promise<ZenroomResult> => {
return zencode_valid_code(zencode, 0);
return zencode_valid_code(zencode, conf, 0);
}

0 comments on commit 4f37f56

Please sign in to comment.