vengeful-god
v2.0.0
Published
Angrily disable bad JS behavior, be sure to load polyfills prior to this...
Downloads
7
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.
eval
will only run in the global scope, implicit returns still workFunction
will only accept a single argument, usearguments
instead of named parameters if you useFunction
- No type coercion for builtin types, use
String()
/Number()
instead. .valueOf
during coercion orNumber()
will not be allowed to returnNaN
..valueOf
must return astring
ornumber
during coercion..toString
must return astring
during coercion.- Somewhat informative messages on failed coercion
Object.prototype
is set to not have any properties- Builtin prototypes are frozen, as are constructors
- throws on
Object.setPrototypeOf()
- throws on
.__proto__
- throws on
Boolean
,Number
, andString
constructors from creating object wrappers (new Boolean
), allows extend still - throws on
Boolean
,Number
, andString
constructors odd behavior forctor.call(primitive)
,ctor()
, andctor(more, than, one, arg)