Allow `predef` option to be an object #5

wants to merge 1 commit into


None yet
2 participants

When calling JSLINT(input, options), you aren't currently able to specify the read-only status of predefined global variables unless you use the /*globals foo:true */ in-code comment. The options.predef option is currently restricted to an array of predefined globals, each of which is assumed to be read-only.

This commit adds the ability to specify the predef option as an object, with the variable name as the key and the read-only status as a boolean:

JSLINT(input, {predef: {foo: true, bar: false}});
// Equivalent to having the following comment in the input:
/*globals foo:true, bar */
Allow `predef` option to be an object, to allow the specification of …
…the read-only status of each variable (similar to `/*globals foo:true */`)

douglascrockford commented Dec 2, 2010

Good idea. Thanks.

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment