Completed
Push — master ( b8c0d7...8cf4a8 )
by Pieter Epeüs
21s queued 10s
created

helpers.module.js ➔ i   B

Complexity

Conditions 8

Size

Total Lines 1
Code Lines 1

Duplication

Lines 1
Ratio 100 %

Importance

Changes 0
Metric Value
eloc 1
dl 1
loc 1
rs 7.3333
c 0
b 0
f 0
cc 8
1 View Code Duplication
function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function e(t){return(e=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function r(t,e){return(r=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function n(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}function u(t,e,i){return(u=n()?Reflect.construct:function(t,e,n){var u=[null];u.push.apply(u,e);var i=new(Function.bind.apply(t,u));return n&&r(i,n.prototype),i}).apply(null,arguments)}function i(t){var n="function"==typeof Map?new Map:void 0;return(i=function(t){if(null===t||-1===Function.toString.call(t).indexOf("[native code]"))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(t))return n.get(t);n.set(t,i)}function i(){return u(t,arguments,e(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),r(i,t)})(t)}var o=require("./modules/multisort.js"),s=require("./modules/multifilter.js"),f=require("./modules/multikey.js"),c=require("./modules/intersect.js"),l=require("./modules/min.js"),p=require("./modules/max.js"),a=require("./modules/diff.js"),y=require("./modules/unique.js"),m=require("./modules/summ.js"),h=require("./modules/average.js"),d=require("./modules/random.js"),g=require("./modules/getByKey.js"),j=require("./modules/first.js"),b=require("./modules/last.js");module.exports={Arr:function(e){var r,n;function u(){return e.apply(this,arguments)||this}n=e,(r=u).prototype=Object.create(n.prototype),r.prototype.constructor=r,r.__proto__=n;var i,q,v,k=u.prototype;return k.multisort=function(t,e){return o(this[0],t,e)},k.multifilter=function(t,e,r){return s(this[0],t,e,r)},k.multikey=function(t){return f(this[0],t)},k.intersect=function(t,e){return c(this[0],t,e)},k.diff=function(t,e){return a(this[0],t,e)},k.pushIfNotExists=function(t){return this.indexOf(t)<0&&this.push(t),this.length},k.pushMultiple=function(t){return this.push.apply(this,t),this.length},k.pushMultipleIfNotExists=function(t){var e=this;return t.forEach(function(t){e.pushIfNotExists(t)}),e.length},k.getByKey=function(t,e){return g(this[0],t,e)},i=u,q=[{key:"unique",get:function(){return y(this[0])}},{key:"max",get:function(){return p(this[0])}},{key:"min",get:function(){return l(this[0])}},{key:"random",get:function(){return d(this)}},{key:"summ",get:function(){return m(this[0])}},{key:"average",get:function(){return h(this[0])}},{key:"first",get:function(){return j(this[0])}},{key:"last",get:function(){return b(this[0])}}],v=[{key:Symbol.species,get:function(){return Array}}],q&&t(i.prototype,q),v&&t(i,v),u}(i(Array)),multisort:o,multifilter:s,multikey:f,intersect:c,min:l,max:p,diff:a,unique:y,summ:m,average:h,random:d,getByKey:g,first:j,last:b};
0 ignored issues
show
Bug introduced by
The variable Symbol seems to be never declared. If this is a global, consider adding a /** global: Symbol */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
Comprehensibility introduced by
It seems like you are trying to overwrite a function name here. i is already defined in line 1 as a function. While this will work, it can be very confusing.
Loading history...
Comprehensibility introduced by
It seems like you are trying to overwrite a function name here. r is already defined in line 1 as a function. While this will work, it can be very confusing.
Loading history...
Coding Style introduced by
Consider using undefined instead of void(0). It is equivalent and more straightforward to read.
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...
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...
Comprehensibility introduced by
It seems like you are trying to overwrite a function name here. u is already defined in line 1 as a function. While this will work, it can be very confusing.
Loading history...
Unused Code introduced by
The parameter i is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
Comprehensibility introduced by
It seems like you are trying to overwrite a function name here. e is already defined in line 1 as a function. While this will work, it can be very confusing.
Loading history...
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
Coding Style introduced by
This line has a length of 3152. Maximum allowed is 120.
Loading history...
introduced by
't' is already declared in the upper scope.
Loading history...
introduced by
'e' is already declared in the upper scope.
Loading history...
Compatibility Best Practice introduced by
Instead of var consider using ECMAScript 6's const or let which have stricter semantics.
Loading history...
Coding Style introduced by
All 'var' declarations must be at the top of the function scope.
Loading history...
introduced by
'r' is already declared in the upper scope.
Loading history...
Coding Style introduced by
As per coding-style, please do not use ++, but use += 1 instead.
Loading history...
introduced by
'n' is already declared in the upper scope.
Loading history...
introduced by
Expected an assignment or function call and instead saw an expression.
Loading history...
introduced by
Unexpected use of comma operator.
Loading history...
introduced by
'e' is a function.
Loading history...
Best Practice introduced by
Unexpected unnamed function.

It is becoming a best practice to add a name even to function expressions to aid in debugging as it produces better stack traces:

MyClass.prototype.someFunction = function someFunction() {
}

As you can see, someFunction is repeated twice above. Instead of having stack traces referencing anonymous function, you will now see the actual function name that was called.

Loading history...
introduced by
The '__proto__' property is deprecated.
Loading history...
introduced by
'r' is a function.
Loading history...
introduced by
Return statement should not contain assignment.
Loading history...
introduced by
Expected literal to be on the right side of ==.
Loading history...
Bug Best Practice introduced by
Apart from some edge-cases, it is generally advisable to use the strict comparison === instead of ==.

The loose comparison such as == or != might produce some weird results for some values, unless you explicitly want to have this behavior here, better use the strict alternative.

Learn more about loose comparison in Javascript.

Loading history...
Unused Code introduced by
't' is defined but never used. Allowed unused args must match /res|next|^err/u.
Loading history...
Unused Code introduced by
'e' is defined but never used. Allowed unused args must match /res|next|^err/u.
Loading history...
Unused Code introduced by
'i' is defined but never used. Allowed unused args must match /res|next|^err/u.
Loading history...
introduced by
'i' is already declared in the upper scope.
Loading history...
introduced by
Use the spread operator instead of '.apply()'.
Loading history...
introduced by
'u' is a function.
Loading history...
introduced by
'u' is already declared in the upper scope.
Loading history...
introduced by
Use the rest parameters instead of 'arguments'.
Loading history...
introduced by
Expected 'undefined' and instead saw 'void'.
Loading history...
introduced by
'i' is a function.
Loading history...
introduced by
Expected literal to be on the right side of ===.
Loading history...
introduced by
Expected literal to be on the right side of !=.
Loading history...
Bug Best Practice introduced by
Apart from some edge-cases, it is generally advisable to use the strict comparison !== instead of !=.

The loose comparison such as == or != might produce some weird results for some values, unless you explicitly want to have this behavior here, better use the strict alternative.

Learn more about loose comparison in Javascript.

Loading history...
introduced by
'i' was used before it was defined.
Loading history...
introduced by
Expected 1 empty line after require statement not followed by another require.
Loading history...
Coding Style introduced by
As per coding-style, please split var declaration into multiple statements.
Loading history...
introduced by
Unable to resolve path to module './modules/multisort.js'.
Loading history...
introduced by
Unable to resolve path to module './modules/multifilter.js'.
Loading history...
introduced by
Unable to resolve path to module './modules/multikey.js'.
Loading history...
introduced by
Unable to resolve path to module './modules/intersect.js'.
Loading history...
introduced by
Unable to resolve path to module './modules/min.js'.
Loading history...
introduced by
Unable to resolve path to module './modules/max.js'.
Loading history...
introduced by
Unable to resolve path to module './modules/diff.js'.
Loading history...
introduced by
Unable to resolve path to module './modules/unique.js'.
Loading history...
introduced by
Unable to resolve path to module './modules/summ.js'.
Loading history...
introduced by
Unable to resolve path to module './modules/average.js'.
Loading history...
introduced by
Unable to resolve path to module './modules/random.js'.
Loading history...
introduced by
Unable to resolve path to module './modules/getByKey.js'.
Loading history...
introduced by
Unable to resolve path to module './modules/first.js'.
Loading history...
introduced by
Unable to resolve path to module './modules/last.js'.
Loading history...
Best Practice introduced by
Unexpected unnamed method 'get'.

It is becoming a best practice to add a name even to function expressions to aid in debugging as it produces better stack traces:

MyClass.prototype.someFunction = function someFunction() {
}

As you can see, someFunction is repeated twice above. Instead of having stack traces referencing anonymous function, you will now see the actual function name that was called.

Loading history...
introduced by
Expected method shorthand.
Loading history...
2
//# sourceMappingURL=helpers.module.js.map
0 ignored issues
show
introduced by
Expected exception block, space or tab after '//' in comment.
Loading history...
3