dougwilson / nodejs-depd

Deprecate all the things
MIT License
325 stars 87 forks source link

Remove use of eval on supported platforms #33

Open GabrielCastro opened 5 years ago

GabrielCastro commented 5 years ago

Solves #20

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

dougwilson commented 4 years ago

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+ 👍

vicb commented 4 years ago

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 !