Tests now work

Also they'll work in the node API too now
This commit is contained in:
Matt C 2018-08-20 19:08:01 +01:00
parent 821dd9c48c
commit 84eaaf4819
3 changed files with 10 additions and 5 deletions

View file

@ -34,10 +34,14 @@ class ToMessagePack extends Operation {
*/
run(input, args) {
try {
return notepack.encode(input);
if (ENVIRONMENT_IS_WORKER()) {
return notepack.encode(input);
} else {
return notepack.encode(input).buffer;
}
} catch (err) {
throw new OperationError(`Could not encode JSON to MessagePack: ${err}`);
}
}
}
}