Unpacking structures without eval
wirelyre opened this issue · comments
My environment disallows eval
and variants. It fails to construct a function at runtime (line 444):
Lines 441 to 455 in 3a6c46e
Is there a configuration option to just use the slow path? I'd like to keep using the record extension to save space — I'm assuming it's probably still faster than decoding a regular map anyway.
Yeah, that seems reasonable to support. Would this need a configuration option, or can these be detected automatically? That is, does a test call like new Function('')
throw an error in your environment, that can be caught to detect that eval-variants are disallowed and automatically opt of using it?
I didn't think of that!
Yes, it throws an EvalError
, and yes, it can be caught.
Thanks for verifying. Published in v1.5.5.