Passed
Branch v18.x (ed6c94)
by Rafael S.
05:21
created

scripts/polyfills.min.js   A

Complexity

Total Complexity 21
Complexity/F 3

Size

Lines of Code 1
Function Count 7

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 1
rs 10
c 0
b 0
f 0
wmc 21
mnd 14
bc 14
fnc 7
bpm 2
cpm 3
noi 10
1
/*! https://mths.be/codepointat v0.2.0 by @mathias */
2
String.prototype.codePointAt||function(){var e=function(){try{var e={},t=Object.defineProperty,r=t(e,e,e)&&t}catch(e){}return r}(),t=function(e){if(null==this)throw TypeError();var t=String(this),r=t.length,o=e?Number(e):0;if(o!=o&&(o=0),!(o<0||o>=r)){var n,c=t.charCodeAt(o);return c>=55296&&c<=56319&&r>o+1&&(n=t.charCodeAt(o+1))>=56320&&n<=57343?1024*(c-55296)+n-56320+65536:c}};e?e(String.prototype,"codePointAt",{value:t,configurable:!0,writable:!0}):String.prototype.codePointAt=t}(),function(){if(!Object.defineProperty||!function(){try{return Object.defineProperty({},"x",{}),!0}catch(e){return!1}}()){var e=Object.defineProperty;Object.defineProperty=function(t,r,o){if(e)try{return e(t,r,o)}catch(e){}if(t!==Object(t))throw TypeError("Object.defineProperty called on non-object");return Object.prototype.__defineGetter__&&"get"in o&&Object.prototype.__defineGetter__.call(t,r,o.get),Object.prototype.__defineSetter__&&"set"in o&&Object.prototype.__defineSetter__.call(t,r,o.set),"value"in o&&(t[r]=o.value),t}}}();var testObject={t:"o"},replaceGetOwnPropertyDescriptor=!1;try{Object.getOwnPropertyDescriptor(testObject,"t")}catch(e){replaceGetOwnPropertyDescriptor=!0}replaceGetOwnPropertyDescriptor&&(Object.getOwnPropertyDescriptor=function(e,t){return null!=("function"==typeof e.__lookupGetter__&&"function"==typeof e.__lookupSetter__?e.__lookupGetter__(t)||e.__lookupSetter__(t):null)?{configurable:!0,enumerable:!0,get:e.__lookupGetter__(t),set:e.__lookupSetter__(t)}:{configurable:!0,writable:!0,enumerable:!0,value:e[t]}});
0 ignored issues
show
Coding Style Best Practice introduced by
Curly braces around statements make for more readable code and help prevent bugs when you add further statements.

Consider adding curly braces around all statements when they are executed conditionally. This is optional if there is only one statement, but leaving them out can lead to unexpected behaviour if another statement is added later.

Consider:

if (a > 0)
    b = 42;

If you or someone else later decides to put another statement in, only the first statement will be executed.

if (a > 0)
    console.log("a > 0");
    b = 42;

In this case the statement b = 42 will always be executed, while the logging statement will be executed conditionally.

if (a > 0) {
    console.log("a > 0");
    b = 42;
}

ensures that the proper code will be executed conditionally no matter how many statements are added or removed.

Loading history...
Bug introduced by
The variable e seems to be never initialized.
Loading history...
Unused Code introduced by
The variable e seems to be never used. Consider removing it.
Loading history...
Comprehensibility introduced by
Usage of the sequence operator is discouraged, since it may lead to obfuscated code.

The sequence or comma operator allows the inclusion of multiple expressions where only is permitted. The result of the sequence is the value of the last expression.

This operator is most often used in for statements.

Used in another places it can make code hard to read, especially when people do not realize it even exists as a seperate operator.

This check looks for usage of the sequence operator in locations where it is not necessary and could be replaced by a series of expressions or statements.

var a,b,c;

a = 1, b = 1,  c= 3;

could just as well be written as:

var a,b,c;

a = 1;
b = 1;
c = 3;

To learn more about the sequence operator, please refer to the MDN.

Loading history...
Bug introduced by
The variable n seems to not be initialized for all possible execution paths.
Loading history...
Compatibility Best Practice introduced by
You are extending the built-in type Object. This may have unintended consequences on other objects using this built-in type. Consider subclassing instead.
Loading history...
Best Practice introduced by
Comparing null to this using the == operator is not safe. Consider using === instead.
Loading history...
Compatibility Best Practice introduced by
You are extending the built-in type String. This may have unintended consequences on other objects using this built-in type. Consider subclassing instead.
Loading history...
Best Practice introduced by
Comparing null to "function" == typeof e._...lookupSetter__(t): null using the != operator is not safe. Consider using !== instead.
Loading history...
Complexity Best Practice introduced by
There is no return statement if o != o && o = 0, !(o < 0 || o >= r) is false. Are you sure this is correct? If so, consider adding return; explicitly.

This check looks for functions where a return statement is found in some execution paths, but not in all.

Consider this little piece of code

function isBig(a) {
    if (a > 5000) {
        return "yes";
    }
}

console.log(isBig(5001)); //returns yes
console.log(isBig(42)); //returns undefined

The function isBig will only return a specific value when its parameter is bigger than 5000. In any other case, it will implicitly return undefined.

This behaviour may not be what you had intended. In any case, you can add a return undefined to the other execution path to make the return value explicit.

Loading history...