Observing whether a function is strict

Claude Pache claude.pache at gmail.com
Thu May 26 07:48:44 UTC 2016


I was wondering whether there is a way to observe whether a given random function is strict (or sloppy, or neither).

Apart from flawed guess based on `Function#toString` (flawed, because it could only detect "use strict" prologue, which is insufficient), the only way I see is to observe whether the nonstandard, deprecated and unbeloved `Function#arguments` and  `Function#caller` functionalities throw an error. Are there other ways. (If not, I find it somewhat unfortunate that only such nonstandard features leak this information.)


More information about the es-discuss mailing list