I implemented spectrum color picker, and I'm trying to fix up the JSLint errors. I have 2 types of errors which I can't seem to fix. Here are the errors
'var' was used before it was defined
Move the invocation into the parens that contain the function
Here's the code with the errors:
(function (factory) {
"use strict";
if (typeof define === 'function' && define.amd) { // AMD
define(['jquery'], factory);
} else if (typeof exports === "object" && typeof module === "object") { // CommonJS
module.exports = factory;
} else { // Browser
factory(jQuery);
}
})(function($, undefined) {
"use strict";
...
define
, exports
, and module
all have the error that it's not defined.
Then the second function: })(function($, undefined) {
has the 2nd error mentioned above. So I checked up that error, and I tried what it said: }(function ($, undefined) ) {
I moved the closing parenthesis to the end, and I now get the following error:
Expected '{' and instead saw '}'.
How can I fix the 2 errors mentioned above?
See Question&Answers more detail:os