From edafa230fd74d06ec5f292c7ba471c932942a7c1 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Thu, 18 Jan 2018 08:13:42 +1100 Subject: src/defs.js: Don't use assert, use TypeError --- src/defs.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/defs.js b/src/defs.js index a203db6..80a3906 100644 --- a/src/defs.js +++ b/src/defs.js @@ -1,6 +1,5 @@ "use strict"; -const assert = require('assert'); const luaconf = require('./luaconf.js'); // To avoid charCodeAt everywhere @@ -172,7 +171,7 @@ const luastring_eq = function(a, b) { }; const to_jsstring = function(value, from, to) { - assert(is_luastring(value), "jsstring expects a Uint8Array"); + if (!is_luastring(value)) throw new TypeError("to_jsstring expects a Uint8Array"); if (to === void 0) { to = value.length; @@ -238,6 +237,7 @@ const uri_allowed = (";,/?:@&=+$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUV /* utility function to convert a lua string to a js string with uri escaping */ const to_uristring = function(a) { + if (!is_luastring(a)) throw new TypeError("to_uristring expects a Uint8Array"); let s = ""; for (let i=0; i