Total Complexity | 18 |
Complexity/F | 2.57 |
Lines of Code | 3 |
Function Count | 7 |
Duplicated Lines | 1 |
Ratio | 33.33 % |
Changes | 0 |
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
1 | View Code Duplication | (function(e,b){"object"===typeof exports&&"undefined"!==typeof module?b(exports):"function"===typeof define&&define.amd?define(["exports"],b):(e=e||self,b(e.UintBuffer={}))})(this,function(e){var b=function(a){this.bits=a;this.bytes=8>a?1:Math.ceil(a/8);this.max=Math.pow(2,a)-1;this.min=0;a=8-((a-1|7)+1-a);this.lastByteMask_=Math.pow(2,0<a?a:8)-1};b.prototype.pack=function(a,d,c){c=void 0===c?0:c;if(d!==d||"number"!=typeof d)throw new TypeError;this.overflow(d);a[c]=(0>d?d+Math.pow(2,this.bits):d)& |
|
2 | 255;c++;for(var b=this.bytes,e=2;e<b;e++)a[c]=Math.floor(d/Math.pow(2,8*(e-1)))&255,c++;8<this.bits&&(a[c]=Math.floor(d/Math.pow(2,8*(this.bytes-1)))&this.lastByteMask_,c++);return c};b.prototype.unpack=function(a,d){var c=this.unpackUnsafe(a,void 0===d?0:d);this.overflow(c);return c};b.prototype.unpackUnsafe=function(a,d){for(var c=0,b=0;b<this.bytes;b++)c+=a[d+b]*Math.pow(256,b);return c};b.prototype.overflow=function(a){if(a>this.max||a<this.min)throw new RangeError;};e.UintBuffer=b;Object.defineProperty(e, |
||
3 | "__esModule",{value:!0})}); |
||
4 |