diff options
author | daurnimator <quae@daurnimator.com> | 2018-01-06 18:22:44 +1100 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2018-01-06 18:22:44 +1100 |
commit | 12b37db70edf83849dcf88b4e50e987234561695 (patch) | |
tree | e3956f177ec356458858899d17d3445ad6021d8b | |
parent | 6fbbd03a4f135103e730ac4a5dce68ec1aa7559f (diff) | |
download | fengari-12b37db70edf83849dcf88b4e50e987234561695.tar.gz fengari-12b37db70edf83849dcf88b4e50e987234561695.tar.bz2 fengari-12b37db70edf83849dcf88b4e50e987234561695.zip |
src/defs.js: Avoid for..of, as generated code uses Symbol.iterator, which might not be available in older environments
-rw-r--r-- | src/defs.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/defs.js b/src/defs.js index 1613bac..bb98485 100644 --- a/src/defs.js +++ b/src/defs.js @@ -190,10 +190,11 @@ const to_jsstring = function(value, from, to) { return str; }; -const uri_allowed = {}; /* bytes allowed unescaped in a uri */ -for (let c of ";,/?:@&=+$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,-_.!~*'()#") { +/* bytes allowed unescaped in a uri */ +const uri_allowed = (";,/?:@&=+$abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,-_.!~*'()#").split('').reduce(function(uri_allowed, c) { uri_allowed[c.charCodeAt(0)] = true; -} + return uri_allowed; +}, {}); /* utility function to convert a lua string to a js string with uri escaping */ const to_uristring = function(a) { |