Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JSHint Function Complexity
{
"globals": {
"console": false,
"jQuery": false,
"_": false
},
"maxparams": 5,
"maxdepth": 5,
"maxstatements": 25,
"maxcomplexity": 10,
"es5": true,
"browser": true,
"boss": false,
"curly": false,
"debug": false,
"devel": false,
"eqeqeq": true,
"evil": true,
"forin": false,
"immed": true,
"laxbreak": false,
"newcap": true,
"noarg": true,
"noempty": false,
"nonew": false,
"nomen": false,
"onevar": true,
"plusplus": false,
"regexp": false,
"undef": true,
"sub": true,
"strict": false,
"white": true,
"unused": true
}
/*jshint maxcomplexity:3 */
/*global console:false */
(function( undefined ) {
"use strict";
function isPrime( number ) {
var prime = true, i;
if ( isNumber( number ) ) {
for ( i = 2; i < number; i++ ) {
if ( number % i === 0 ) {
prime = false;
}
}
} else {
prime = false;
}
return prime;
}
function isNumber( number ) {
return !isNaN( parseFloat( number ) ) && isFinite( number );
}
console.log( isPrime( 109 ) );
}());
/*jshint maxparams:3, maxdepth:2, maxstatements:5 */
/*global console:false */
(function( undefined ) {
"use strict";
function test1( arg1, arg2, arg3, arg4 ) {
console.log( "too many parameters!" );
if ( arg1 === 1 ) {
console.log( arg1 );
if ( arg2 === 2 ) {
console.log( arg2 );
if( arg3 === 3 ) {
console.log( "too much nesting!" );
console.log( arg3 );
console.log( arg4 );
}
}
}
console.log( "too many statements!" );
}
test1( 1, 2, 3, 4 );
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.