vengeful-god
v2.0.0
Published
Angrily disable bad JS behavior, be sure to load polyfills prior to this...
Readme
Are you paranoid, do you want some slightly saner rules for JS?
Do you wish to punish those who do not have sane type coercion going on?
Do you wish to punish those who try to use eval locally?
Well this is the globally monkey-punching module for you!
- The global object is frozen. No accidental globals allowed.
evalwill only run in the global scope, implicit returns still workFunctionwill only accept a single argument, useargumentsinstead of named parameters if you useFunction- No type coercion for builtin types, use
String()/Number()instead. .valueOfduring coercion orNumber()will not be allowed to returnNaN..valueOfmust return astringornumberduring coercion..toStringmust return astringduring coercion.- Somewhat informative messages on failed coercion
Object.prototypeis set to not have any properties- Builtin prototypes are frozen, as are constructors
- throws on
Object.setPrototypeOf() - throws on
.__proto__ - throws on
Boolean,Number, andStringconstructors from creating object wrappers (new Boolean), allows extend still - throws on
Boolean,Number, andStringconstructors odd behavior forctor.call(primitive),ctor(), andctor(more, than, one, arg)
