nodejs-depd icon indicating copy to clipboard operation
nodejs-depd copied to clipboard

Remove use of eval on supported platforms

Open GabrielCastro opened this issue 6 years ago • 2 comments

Solves #20

This drops the use of eval on versions of node that support setting function arity

GabrielCastro avatar Mar 27 '19 21:03 GabrielCastro

Nice, I didn't realize you can set the length of a function now. Looks like it's support on all "modern" Node.js runtimes (4+). I feel it would be weird to have this different of a behavior between the runtimes, as it seems with the issues opened here that not using eval is desired in a general stance, and I don't disagree. I will queue up a 3.0 release that will use the function length setting (your PR) and just only support Node.js 4+ 👍

dougwilson avatar Apr 17 '20 06:04 dougwilson

It would be super nice to release this.

The current release generates an error with rollup:

node_modules/depd/index.js
408: 
409:    // eslint-disable-next-line no-eval
410:   var deprecatedfn = eval('(function (' + args + ') {\n' +
                          ^
411:     '"use strict"\n' +
412:     'log.call(deprecate, message, site)\n' +
created run/index.js in 25.4s

Thanks for this module !

vicb avatar Jul 10 '20 20:07 vicb