rjrodger/ordu

View on GitHub

Showing 66 of 236 total issues

Similar blocks of code found in 4 locations. Consider refactoring.
Open

Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  offset = offset >>> 0
  if (!noAssert) checkOffset(offset, 4, this.length)
  return ieee754.read(this, offset, false, 23, 4)
}
Severity: Major
Found in test-web/test-web.js and 3 other locations - About 1 hr to fix
test-web/test-web.js on lines 1464..1468
test-web/test-web.js on lines 1476..1480
test-web/test-web.js on lines 1482..1486

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 69.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    expect(
      taskend_log.map((te) => te.name + '~' + te.op + '~' + te.operate.stop)
    ).equal([
      'A~next~false',
      'B~skip~false',
Severity: Major
Found in test-web/test-web.js and 1 other location - About 1 hr to fix
test-web/test-web.js on lines 6674..6685

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 68.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    expect(taskresult_log.map((te) => te.name + '~' + te.op)).equal([
      'A~next',
      'B~skip',
      `task${++tI}~next`,
      `task${++tI}~merge`,
Severity: Major
Found in test-web/test-web.js and 1 other location - About 1 hr to fix
test-web/test-web.js on lines 6688..6701

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 68.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Ordu=t()}}((function(){var t,e,r,n=(t=function(t,r){(function(t){(function(){"use strict";function t(t){if(t>2147483647)throw new RangeError('The value "'+t+'" is invalid for option "size"');var e=new Uint8Array(t);return e.__proto__=n.prototype,e}function n(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return s(t)}return o(t,e,r)}function o(e,r,o){if("string"==typeof e)return function(e,r){if("string"==typeof r&&""!==r||(r="utf8"),!n.isEncoding(r))throw new TypeError("Unknown encoding: "+r);var o=0|f(e,r),i=t(o),s=i.write(e,r);return s!==o&&(i=i.slice(0,s)),i}(e,r);if(ArrayBuffer.isView(e))return u(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(R(e,ArrayBuffer)||e&&R(e.buffer,ArrayBuffer))return function(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');var o;return(o=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r)).__proto__=n.prototype,o}(e,r,o);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return n.from(i,r,o);var s=function(e){if(n.isBuffer(e)){var r=0|a(e.length),o=t(r);return 0===o.length||e.copy(o,0,0,r),o}return void 0!==e.length?"number"!=typeof e.length||N(e.length)?t(0):u(e):"Buffer"===e.type&&Array.isArray(e.data)?u(e.data):void 0}(e);if(s)return s;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return n.from(e[Symbol.toPrimitive]("string"),r,o);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function i(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function s(e){return i(e),t(e<0?0:0|a(e))}function u(e){for(var r=e.length<0?0:0|a(e.length),n=t(r),o=0;o<r;o+=1)n[o]=255&e[o];return n}function a(t){if(t>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+2147483647..toString(16)+" bytes");return 0|t}function f(t,e){if(n.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||R(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);var r=t.length,o=arguments.length>2&&!0===arguments[2];if(!o&&0===r)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return C(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return P(t).length;default:if(i)return o?-1:C(t).length;e=(""+e).toLowerCase(),i=!0}}function c(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function l(t,e,r,o,i){if(0===t.length)return-1;if("string"==typeof r?(o=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),N(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=n.from(e,o)),n.isBuffer(e))return 0===e.length?-1:h(t,e,r,o,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):h(t,[e],r,o,i);throw new TypeError("val must be string, number or Buffer")}function h(t,e,r,n,o){var i,s=1,u=t.length,a=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;s=2,u/=2,a/=2,r/=2}function f(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(o){var c=-1;for(i=r;i<u;i++)if(f(t,i)===f(e,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===a)return c*s}else-1!==c&&(i-=i-c),c=-1}else for(r+a>u&&(r=u-a),i=r;i>=0;i--){for(var l=!0,h=0;h<a;h++)if(f(t,i+h)!==f(e,h)){l=!1;break}if(l)return i}return-1}function p(t,e,r,n){r=Number(r)||0;var o=t.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=e.length;n>i/2&&(n=i/2);for(var s=0;s<n;++s){var u=parseInt(e.substr(2*s,2),16);if(N(u))return s;t[r+s]=u}return s}function y(t,e,r,n){return U(C(e,t.length-r),t,r,n)}function g(t,e,r,n){return U(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function d(t,e,r,n){return g(t,e,r,n)}function v(t,e,r,n){return U(P(e),t,r,n)}function m(t,e,r,n){return U(function(t,e){for(var r,n,o,i=[],s=0;s<t.length&&!((e-=2)<0);++s)n=(r=t.charCodeAt(s))>>8,o=r%256,i.push(o),i.push(n);return i}(e,t.length-r),t,r,n)}function w(t,e,r){return 0===e&&r===t.length?A.fromByteArray(t):A.fromByteArray(t.slice(e,r))}function b(t,e,r){r=Math.min(t.length,r);for(var n=[],o=e;o<r;){var i,s,u,a,f=t[o],c=null,l=f>239?4:f>223?3:f>191?2:1;if(o+l<=r)switch(l){case 1:f<128&&(c=f);break;case 2:128==(192&(i=t[o+1]))&&(a=(31&f)<<6|63&i)>127&&(c=a);break;case 3:i=t[o+1],s=t[o+2],128==(192&i)&&128==(192&s)&&(a=(15&f)<<12|(63&i)<<6|63&s)>2047&&(a<55296||a>57343)&&(c=a);break;case 4:i=t[o+1],s=t[o+2],u=t[o+3],128==(192&i)&&128==(192&s)&&128==(192&u)&&(a=(15&f)<<18|(63&i)<<12|(63&s)<<6|63&u)>65535&&a<1114112&&(c=a)}null===c?(c=65533,l=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=l}return function(t){var e=t.length;if(e<=E)return String.fromCharCode.apply(String,t);for(var r="",n=0;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=E));return r}(n)}r.Buffer=n,r.INSPECT_MAX_BYTES=50,n.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(e){return!1}}(),n.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(n.prototype,"parent",{enumerable:!0,get:function(){if(n.isBuffer(this))return this.buffer}}),Object.defineProperty(n.prototype,"offset",{enumerable:!0,get:function(){if(n.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&n[Symbol.species]===n&&Object.defineProperty(n,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),n.poolSize=8192,n.from=function(t,e,r){return o(t,e,r)},n.prototype.__proto__=Uint8Array.prototype,n.__proto__=Uint8Array,n.alloc=function(e,r,n){return function(e,r,n){return i(e),e<=0?t(e):void 0!==r?"string"==typeof n?t(e).fill(r,n):t(e).fill(r):t(e)}(e,r,n)},n.allocUnsafe=function(t){return s(t)},n.allocUnsafeSlow=function(t){return s(t)},n.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==n.prototype},n.compare=function(t,e){if(R(t,Uint8Array)&&(t=n.from(t,t.offset,t.byteLength)),R(e,Uint8Array)&&(e=n.from(e,e.offset,e.byteLength)),!n.isBuffer(t)||!n.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;for(var r=t.length,o=e.length,i=0,s=Math.min(r,o);i<s;++i)if(t[i]!==e[i]){r=t[i],o=e[i];break}return r<o?-1:o<r?1:0},n.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},n.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return n.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var o=n.allocUnsafe(e),i=0;for(r=0;r<t.length;++r){var s=t[r];if(R(s,Uint8Array)&&(s=n.from(s)),!n.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(o,i),i+=s.length}return o},n.byteLength=f,n.prototype._isBuffer=!0,n.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)c(this,e,e+1);return this},n.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)c(this,e,e+3),c(this,e+1,e+2);return this},n.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)c(this,e,e+7),c(this,e+1,e+6),c(this,e+2,e+5),c(this,e+3,e+4);return this},n.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?b(this,0,t):function(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return j(this,e,r);case"utf8":case"utf-8":return b(this,e,r);case"ascii":return _(this,e,r);case"latin1":case"binary":return O(this,e,r);case"base64":return w(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},n.prototype.toLocaleString=n.prototype.toString,n.prototype.equals=function(t){if(!n.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===n.compare(this,t)},n.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return t=this.toString("hex",0,e).replace(/(.{2})/g,"$1 ").trim(),this.length>e&&(t+=" ... "),"<Buffer "+t+">"},n.prototype.compare=function(t,e,r,o,i){if(R(t,Uint8Array)&&(t=n.from(t,t.offset,t.byteLength)),!n.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===o&&(o=0),void 0===i&&(i=this.length),e<0||r>t.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&e>=r)return 0;if(o>=i)return-1;if(e>=r)return 1;if(this===t)return 0;for(var s=(i>>>=0)-(o>>>=0),u=(r>>>=0)-(e>>>=0),a=Math.min(s,u),f=this.slice(o,i),c=t.slice(e,r),l=0;l<a;++l)if(f[l]!==c[l]){s=f[l],u=c[l];break}return s<u?-1:u<s?1:0},n.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},n.prototype.indexOf=function(t,e,r){return l(this,t,e,r,!0)},n.prototype.lastIndexOf=function(t,e,r){return l(this,t,e,r,!1)},n.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-e;if((void 0===r||r>o)&&(r=o),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return p(this,t,e,r);case"utf8":case"utf-8":return y(this,t,e,r);case"ascii":return g(this,t,e,r);case"latin1":case"binary":return d(this,t,e,r);case"base64":return v(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return m(this,t,e,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var E=4096;function _(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(127&t[o]);return n}function O(t,e,r){var n="";r=Math.min(t.length,r);for(var o=e;o<r;++o)n+=String.fromCharCode(t[o]);return n}function j(t,e,r){var n,o=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>o)&&(r=o);for(var i="",s=e;s<r;++s)i+=(n=t[s])<16?"0"+n.toString(16):n.toString(16);return i}function k(t,e,r){for(var n=t.slice(e,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function S(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,r,o,i,s){if(!n.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(r+o>t.length)throw new RangeError("Index out of range")}function B(t,e,r,n,o,i){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function x(t,e,r,n,o){return e=+e,r>>>=0,o||B(t,0,r,4),I.write(t,e,r,n,23,4),r+4}function T(t,e,r,n,o){return e=+e,r>>>=0,o||B(t,0,r,8),I.write(t,e,r,n,52,8),r+8}n.prototype.slice=function(t,e){var r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var o=this.subarray(t,e);return o.__proto__=n.prototype,o},n.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n},n.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t+--e],o=1;e>0&&(o*=256);)n+=this[t+--e]*o;return n},n.prototype.readUInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),this[t]},n.prototype.readUInt16LE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]|this[t+1]<<8},n.prototype.readUInt16BE=function(t,e){return t>>>=0,e||S(t,2,this.length),this[t]<<8|this[t+1]},n.prototype.readUInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},n.prototype.readUInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},n.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=this[t],o=1,i=0;++i<e&&(o*=256);)n+=this[t+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*e)),n},n.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||S(t,e,this.length);for(var n=e,o=1,i=this[t+--n];n>0&&(o*=256);)i+=this[t+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},n.prototype.readInt8=function(t,e){return t>>>=0,e||S(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},n.prototype.readInt16LE=function(t,e){t>>>=0,e||S(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},n.prototype.readInt16BE=function(t,e){t>>>=0,e||S(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},n.prototype.readInt32LE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},n.prototype.readInt32BE=function(t,e){return t>>>=0,e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},n.prototype.readFloatLE=function(t,e){return t>>>=0,e||S(t,4,this.length),I.read(this,t,!0,23,4)},n.prototype.readFloatBE=function(t,e){return t>>>=0,e||S(t,4,this.length),I.read(this,t,!1,23,4)},n.prototype.readDoubleLE=function(t,e){return t>>>=0,e||S(t,8,this.length),I.read(this,t,!0,52,8)},n.prototype.readDoubleBE=function(t,e){return t>>>=0,e||S(t,8,this.length),I.read(this,t,!1,52,8)},n.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||L(this,t,e,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[e]=255&t;++i<r&&(o*=256);)this[e+i]=t/o&255;return e+r},n.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||L(this,t,e,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+r},n.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,255,0),this[e]=255&t,e+1},n.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},n.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},n.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},n.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},n.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);L(this,t,e,r,o-1,-o)}var i=0,s=1,u=0;for(this[e]=255&t;++i<r&&(s*=256);)t<0&&0===u&&0!==this[e+i-1]&&(u=1),this[e+i]=(t/s>>0)-u&255;return e+r},n.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var o=Math.pow(2,8*r-1);L(this,t,e,r,o-1,-o)}var i=r-1,s=1,u=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===u&&0!==this[e+i+1]&&(u=1),this[e+i]=(t/s>>0)-u&255;return e+r},n.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},n.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},n.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},n.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},n.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||L(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},n.prototype.writeFloatLE=function(t,e,r){return x(this,t,e,!0,r)},n.prototype.writeFloatBE=function(t,e,r){return x(this,t,e,!1,r)},n.prototype.writeDoubleLE=function(t,e,r){return T(this,t,e,!0,r)},n.prototype.writeDoubleBE=function(t,e,r){return T(this,t,e,!1,r)},n.prototype.copy=function(t,e,r,o){if(!n.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),o||0===o||(o=this.length),e>=t.length&&(e=t.length),e||(e=0),o>0&&o<r&&(o=r),o===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-e<o-r&&(o=t.length-e+r);var i=o-r;if(this===t&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(e,r,o);else if(this===t&&r<e&&e<o)for(var s=i-1;s>=0;--s)t[s+e]=this[s+r];else Uint8Array.prototype.set.call(t,this.subarray(r,o),e);return i},n.prototype.fill=function(t,e,r,o){if("string"==typeof t){if("string"==typeof e?(o=e,e=0,r=this.length):"string"==typeof r&&(o=r,r=this.length),void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!n.isEncoding(o))throw new TypeError("Unknown encoding: "+o);if(1===t.length){var i=t.charCodeAt(0);("utf8"===o&&i<128||"latin1"===o)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;var s;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(s=e;s<r;++s)this[s]=t;else{var u=n.isBuffer(t)?t:n.from(t,o),a=u.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(s=0;s<r-e;++s)this[s+e]=u[s%a]}return this};var M=/[^+/0-9A-Za-z-_]/g;function C(t,e){var r;e=e||1/0;for(var n=t.length,o=null,i=[],s=0;s<n;++s){if((r=t.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(s+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function P(t){return A.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(M,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function U(t,e,r,n){for(var o=0;o<n&&!(o+r>=e.length||o>=t.length);++o)e[o+r]=t[o];return o}function R(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function N(t){return t!=t}}).call(this)}).call(this,n({}).Buffer)},function(r){return e||t(e={exports:{},parent:r},e.exports),e.exports}),o={},i="object"==typeof Reflect?Reflect:null,s=i&&"function"==typeof i.apply?i.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var u=Number.isNaN||function(t){return t!=t};function a(){a.init.call(this)}(o=a).once=function(t,e){return new Promise((function(r,n){function o(r){t.removeListener(e,i),n(r)}function i(){"function"==typeof t.removeListener&&t.removeListener("error",o),r([].slice.call(arguments))}v(t,e,i,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&v(t,"error",e,{once:!0})}(t,o)}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var f=10;function c(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function l(t){return void 0===t._maxListeners?a.defaultMaxListeners:t._maxListeners}function h(t,e,r,n){var o,i,s,u;if(c(r),void 0===(i=t._events)?(i=t._events=Object.create(null),t._eventsCount=0):(void 0!==i.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),i=t._events),s=i[e]),void 0===s)s=i[e]=r,++t._eventsCount;else if("function"==typeof s?s=i[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(o=l(t))>0&&s.length>o&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,u=a,console&&console.warn&&console.warn(u)}return t}function p(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=function(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}.bind(n);return o.listener=r,n.wrapFn=o,o}function y(t,e,r){var n=t._events;if(void 0===n)return[];var o=n[e];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(o):d(o,o.length)}function g(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function d(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function v(t,e,r,n){if("function"==typeof t.on)n.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function o(i){n.once&&t.removeEventListener(e,o),r(i)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return f},set:function(t){if("number"!=typeof t||t<0||u(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");f=t}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||u(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},a.prototype.getMaxListeners=function(){return l(this)},a.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var n="error"===t,o=this._events;if(void 0!==o)n=n&&void 0===o.error;else if(!n)return!1;if(n){var i;if(e.length>0&&(i=e[0]),i instanceof Error)throw i;var u=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw u.context=i,u}var a=o[t];if(void 0===a)return!1;if("function"==typeof a)s(a,this,e);else{var f=a.length,c=d(a,f);for(r=0;r<f;++r)s(c[r],this,e)}return!0},a.prototype.addListener=function(t,e){return h(this,t,e,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(t,e){return h(this,t,e,!0)},a.prototype.once=function(t,e){return c(e),this.on(t,p(this,t,e)),this},a.prototype.prependOnceListener=function(t,e){return c(e),this.prependListener(t,p(this,t,e)),this},a.prototype.removeListener=function(t,e){var r,n,o,i,s;if(c(e),void 0===(n=this._events))return this;if(void 0===(r=n[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete n[t],n.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(o=-1,i=r.length-1;i>=0;i--)if(r[i]===e||r[i].listener===e){s=r[i].listener,o=i;break}if(o<0)return this;0===o?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,o),1===r.length&&(n[t]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",t,s||e)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(t){var e,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o,i=Object.keys(r);for(n=0;n<i.length;++n)"removeListener"!==(o=i[n])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(n=e.length-1;n>=0;n--)this.removeListener(t,e[n]);return this},a.prototype.listeners=function(t){return y(this,t,!0)},a.prototype.rawListeners=function(t){return y(this,t,!1)},a.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):g.call(t,e)},a.prototype.listenerCount=g,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]};var m=function(...t){try{return JSON.stringify.apply(null,t)}catch(e){return"[Cannot display object: "+e.message+"]"}},w={};w=class extends Error{constructor(t){super(t.filter(t=>""!==t).map(t=>"string"==typeof t?t:t instanceof Error?t.message:m(t)).join(" ")||"Unknown error"),"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,w.assert)}};var b,E=function(t,...e){if(!t){if(1===e.length&&e[0]instanceof Error)throw e[0];throw new w(e)}};const _={};b=function(t,e,r){if(!1===e||null==e)return t;"string"==typeof(r=r||{})&&(r={separator:r});const n=Array.isArray(e);E(!n||!r.separator,"Separator option no valid for array-based chain");const o=n?e:e.split(r.separator||".");let i=t;for(let s=0;s<o.length;++s){let t=o[s];const n=r.iterables&&_.iterables(i);if(Array.isArray(i)||"set"===n){const e=Number(t);Number.isInteger(e)&&(t=e<0?i.length+e:e)}if(!i||"function"==typeof i&&!1===r.functions||!n&&void 0===i[t]){E(!r.strict||s+1===o.length,"Missing segment",t,"in reach path ",e),E("object"==typeof i||!0===r.functions||"function"!=typeof i,"Invalid segment",t,"in reach path ",e),i=r.default;break}i=n?"set"===n?[...i][t]:i.get(t):i[t]}return i},_.iterables=function(t){return t instanceof Set?"set":t instanceof Map?"map":void 0};for(var A={toByteArray:function(t){var e,r,n=x(t),o=n[0],i=n[1],s=new k(function(t,e,r){return 3*(e+r)/4-r}(0,o,i)),u=0,a=i>0?o-4:o;for(r=0;r<a;r+=4)e=j[t.charCodeAt(r)]<<18|j[t.charCodeAt(r+1)]<<12|j[t.charCodeAt(r+2)]<<6|j[t.charCodeAt(r+3)],s[u++]=e>>16&255,s[u++]=e>>8&255,s[u++]=255&e;return 2===i&&(e=j[t.charCodeAt(r)]<<2|j[t.charCodeAt(r+1)]>>4,s[u++]=255&e),1===i&&(e=j[t.charCodeAt(r)]<<10|j[t.charCodeAt(r+1)]<<4|j[t.charCodeAt(r+2)]>>2,s[u++]=e>>8&255,s[u++]=255&e),s},fromByteArray:function(t){for(var e,r=t.length,n=r%3,o=[],i=0,s=r-n;i<s;i+=16383)o.push(T(t,i,i+16383>s?s:i+16383));return 1===n?(e=t[r-1],o.push(O[e>>2]+O[e<<4&63]+"==")):2===n&&(e=(t[r-2]<<8)+t[r-1],o.push(O[e>>10]+O[e>>4&63]+O[e<<2&63]+"=")),o.join("")}},O=[],j=[],k="undefined"!=typeof Uint8Array?Uint8Array:Array,S="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",L=0,B=S.length;L<B;++L)O[L]=S[L],j[S.charCodeAt(L)]=L;function x(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function T(t,e,r){for(var n,o,i=[],s=e;s<r;s+=3)n=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),i.push(O[(o=n)>>18&63]+O[o>>12&63]+O[o>>6&63]+O[63&o]);return i.join("")}j["-".charCodeAt(0)]=62,j["_".charCodeAt(0)]=63;var I={read:function(t,e,r,n,o){var i,s,u=8*o-n-1,a=(1<<u)-1,f=a>>1,c=-7,l=r?o-1:0,h=r?-1:1,p=t[e+l];for(l+=h,i=p&(1<<-c)-1,p>>=-c,c+=u;c>0;i=256*i+t[e+l],l+=h,c-=8);for(s=i&(1<<-c)-1,i>>=-c,c+=n;c>0;s=256*s+t[e+l],l+=h,c-=8);if(0===i)i=1-f;else{if(i===a)return s?NaN:1/0*(p?-1:1);s+=Math.pow(2,n),i-=f}return(p?-1:1)*s*Math.pow(2,i-n)},write:function(t,e,r,n,o,i){var s,u,a,f=8*i-o-1,c=(1<<f)-1,l=c>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,y=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,s=c):(s=Math.floor(Math.log(e)/Math.LN2),e*(a=Math.pow(2,-s))<1&&(s--,a*=2),(e+=s+l>=1?h/a:h*Math.pow(2,1-l))*a>=2&&(s++,a/=2),s+l>=c?(u=0,s=c):s+l>=1?(u=(e*a-1)*Math.pow(2,o),s+=l):(u=e*Math.pow(2,l-1)*Math.pow(2,o),s=0));o>=8;t[r+p]=255&u,p+=y,u/=256,o-=8);for(s=s<<o|u,f+=o;f>0;t[r+p]=255&s,p+=y,s/=256,f-=8);t[r+p-y]|=128*g}},M={};(function(t){(function(){"use strict";const e={};M=M={array:Array.prototype,buffer:t&&t.prototype,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},e.typeMap=new Map([["[object Error]",M.error],["[object Map]",M.map],["[object Promise]",M.promise],["[object Set]",M.set],["[object WeakMap]",M.weakMap],["[object WeakSet]",M.weakSet]]),M.getInternalProto=function(r){if(Array.isArray(r))return M.array;if(t&&r instanceof t)return M.buffer;if(r instanceof Date)return M.date;if(r instanceof RegExp)return M.regex;if(r instanceof Error)return M.error;const n=Object.prototype.toString.call(r);return e.typeMap.get(n)||M.generic}}).call(this)}).call(this,n({}).Buffer);var C={keys:function(t,e={}){return!1!==e.symbols?Reflect.ownKeys(t):Object.getOwnPropertyNames(t)}},P={};(function(t){(function(){"use strict";const e={needsProtoHack:new Set([M.set,M.map,M.weakSet,M.weakMap])};P=e.clone=function(r,n={},o=null){if("object"!=typeof r||null===r)return r;let i=e.clone,s=o;if(n.shallow){if(!0!==n.shallow)return e.cloneWithShallow(r,n);i=t=>t}else if(s){const t=s.get(r);if(t)return t}else s=new Map;const u=M.getInternalProto(r);if(u===M.buffer)return t&&t.from(r);if(u===M.date)return new Date(r.getTime());if(u===M.regex)return new RegExp(r);const a=e.base(r,u,n);if(a===r)return r;if(s&&s.set(r,a),u===M.set)for(const t of r)a.add(i(t,n,s));else if(u===M.map)for(const[t,e]of r)a.set(t,i(e,n,s));const f=C.keys(r,n);for(const t of f){if("__proto__"===t)continue;if(u===M.array&&"length"===t){a.length=r.length;continue}const e=Object.getOwnPropertyDescriptor(r,t);e?e.get||e.set?Object.defineProperty(a,t,e):e.enumerable?a[t]=i(r[t],n,s):Object.defineProperty(a,t,{enumerable:!1,writable:!0,configurable:!0,value:i(r[t],n,s)}):Object.defineProperty(a,t,{enumerable:!0,writable:!0,configurable:!0,value:i(r[t],n,s)})}return a},e.cloneWithShallow=function(t,r){const n=r.shallow;(r=Object.assign({},r)).shallow=!1;const o=new Map;for(const e of n){const r=b(t,e);"object"!=typeof r&&"function"!=typeof r||o.set(r,r)}return e.clone(t,r,o)},e.base=function(t,r,n){if(!1===n.prototype)return e.needsProtoHack.has(r)?new r.constructor:r===M.array?[]:{};const o=Object.getPrototypeOf(t);if(o&&o.isImmutable)return t;if(r===M.array){const t=[];return o!==r&&Object.setPrototypeOf(t,o),t}if(e.needsProtoHack.has(r)){const t=new o.constructor;return o!==r&&Object.setPrototypeOf(t,o),t}return Object.create(o)}}).call(this)}).call(this,n({}).Buffer);var U={};(function(t){(function(){"use strict";const e={};U=e.merge=function(r,n,o){if(E(r&&"object"==typeof r,"Invalid target value: must be an object"),E(null==n||"object"==typeof n,"Invalid source value: must be null, undefined, or an object"),!n)return r;if(o=Object.assign({nullOverride:!0,mergeArrays:!0},o),Array.isArray(n)){E(Array.isArray(r),"Cannot merge array onto an object"),o.mergeArrays||(r.length=0);for(let t=0;t<n.length;++t)r.push(P(n[t],{symbols:o.symbols}));return r}const i=C.keys(n,o);for(let s=0;s<i.length;++s){const u=i[s];if("__proto__"===u||!Object.prototype.propertyIsEnumerable.call(n,u))continue;const a=n[u];if(a&&"object"==typeof a){if(r[u]===a)continue;!r[u]||"object"!=typeof r[u]||Array.isArray(r[u])!==Array.isArray(a)||a instanceof Date||t&&t.isBuffer(a)||a instanceof RegExp?r[u]=P(a,{symbols:o.symbols}):e.merge(r[u],a,o)}else(null!=a||o.nullOverride)&&(r[u]=a)}return r}}).call(this)}).call(this,n({}).Buffer);var R;const N={};R=function(t,e,r={}){if(E(t&&"object"==typeof t,"Invalid defaults value: must be an object"),E(!e||!0===e||"object"==typeof e,"Invalid source value: must be true, falsy or an object"),E("object"==typeof r,"Invalid options: must be an object"),!e)return null;if(r.shallow)return N.applyToDefaultsWithShallow(t,e,r);const n=P(t);if(!0===e)return n;const o=void 0!==r.nullOverride&&r.nullOverride;return U(n,e,{nullOverride:o,mergeArrays:!1})},N.applyToDefaultsWithShallow=function(t,e,r){const n=r.shallow;E(Array.isArray(n),"Invalid keys");const o=new Map,i=!0===e?null:new Set;for(let a of n){a=Array.isArray(a)?a:a.split(".");const r=b(t,a);r&&"object"==typeof r?o.set(r,i&&b(e,a)||r):i&&i.add(a)}const s=P(t,{},o);if(!i)return s;for(const a of i)N.reachCopy(s,e,a);const u=void 0!==r.nullOverride&&r.nullOverride;return U(s,e,{nullOverride:u,mergeArrays:!1})},N.reachCopy=function(t,e,r){for(const i of r){if(!(i in e))return;const t=e[i];if("object"!=typeof t||null===t)return;e=t}const n=e;let o=t;for(let i=0;i<r.length-1;++i){const t=r[i];"object"!=typeof o[t]&&(o[t]={}),o=o[t]}o[r[r.length-1]]=n};var D,z,$,q=D={};function F(){throw new Error("setTimeout has not been defined")}function W(){throw new Error("clearTimeout has not been defined")}function H(t){if(z===setTimeout)return setTimeout(t,0);if((z===F||!z)&&setTimeout)return z=setTimeout,setTimeout(t,0);try{return z(t,0)}catch(e){try{return z.call(null,t,0)}catch(e){return z.call(this,t,0)}}}!function(){try{z="function"==typeof setTimeout?setTimeout:F}catch(e){z=F}try{$="function"==typeof clearTimeout?clearTimeout:W}catch(e){$=W}}();var Y,J=[],V=!1,X=-1;function K(){V&&Y&&(V=!1,Y.length?J=Y.concat(J):X=-1,J.length&&G())}function G(){if(!V){var t=H(K);V=!0;for(var r=J.length;r;){for(Y=J,J=[];++X<r;)Y&&Y[X].run();X=-1,r=J.length}Y=null,V=!1,function(t){if($===clearTimeout)return clearTimeout(t);if(($===W||!$)&&clearTimeout)return $=clearTimeout,clearTimeout(t);try{$(t)}catch(e){try{return $.call(null,t)}catch(e){return $.call(this,t)}}}(t)}}function Z(t,e){this.fun=t,this.array=e}function Q(){}q.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];J.push(new Z(t,e)),1!==J.length||V||H(G)},Z.prototype.run=function(){this.fun.apply(null,this.array)},q.title="browser",q.browser=!0,q.env={},q.argv=[],q.version="",q.versions={},q.on=Q,q.addListener=Q,q.once=Q,q.off=Q,q.removeListener=Q,q.removeAllListeners=Q,q.emit=Q,q.prependListener=Q,q.prependOnceListener=Q,q.listeners=function(t){return[]},q.binding=function(t){throw new Error("process.binding is not supported")},q.cwd=function(){return"/"},q.chdir=function(t){throw new Error("process.chdir is not supported")},q.umask=function(){return 0};var tt={};(function(t){(function(){"use strict";const e={};tt=e.Bench=class{constructor(){this.ts=0,this.reset()}reset(){this.ts=e.Bench.now()}elapsed(){return e.Bench.now()-this.ts}static now(){const e=t.hrtime();return 1e3*e[0]+e[1]/1e6}}}).call(this)}).call(this,D);var et=function(){},rt={};(function(t){(function(){"use strict";const e={mismatched:null};rt=function(t,r,n){return n=Object.assign({prototype:!0},n),!!e.isDeepEqual(t,r,n,[])},e.isDeepEqual=function(r,n,o,i){if(r===n)return 0!==r||1/r==1/n;const s=typeof r;if(s!==typeof n)return!1;if(null===r||null===n)return!1;if("function"===s){if(!o.deepFunction||r.toString()!==n.toString())return!1}else if("object"!==s)return r!=r&&n!=n;const u=e.getSharedType(r,n,!!o.prototype);switch(u){case M.buffer:return t&&t.prototype.equals.call(r,n);case M.promise:return r===n;case M.regex:return r.toString()===n.toString();case e.mismatched:return!1}for(let t=i.length-1;t>=0;--t)if(i[t].isSame(r,n))return!0;i.push(new e.SeenEntry(r,n));try{return!!e.isDeepEqualObj(u,r,n,o,i)}finally{i.pop()}},e.getSharedType=function(t,r,n){if(n)return Object.getPrototypeOf(t)!==Object.getPrototypeOf(r)?e.mismatched:M.getInternalProto(t);const o=M.getInternalProto(t);return o!==M.getInternalProto(r)?e.mismatched:o},e.valueOf=function(t){const e=t.valueOf;if(void 0===e)return t;try{return e.call(t)}catch(r){return r}},e.hasOwnEnumerableProperty=function(t,e){return Object.prototype.propertyIsEnumerable.call(t,e)},e.isSetSimpleEqual=function(t,e){for(const r of Set.prototype.values.call(t))if(!Set.prototype.has.call(e,r))return!1;return!0},e.isDeepEqualObj=function(t,r,n,o,i){const{isDeepEqual:s,valueOf:u,hasOwnEnumerableProperty:a}=e,{keys:f,getOwnPropertySymbols:c}=Object;if(t===M.array){if(!o.part){if(r.length!==n.length)return!1;for(let t=0;t<r.length;++t)if(!s(r[t],n[t],o,i))return!1;return!0}for(const t of r)for(const e of n)if(s(t,e,o,i))return!0}else if(t===M.set){if(r.size!==n.size)return!1;if(!e.isSetSimpleEqual(r,n)){const t=new Set(Set.prototype.values.call(n));for(const e of Set.prototype.values.call(r)){if(t.delete(e))continue;let r=!1;for(const n of t)if(s(e,n,o,i)){t.delete(n),r=!0;break}if(!r)return!1}}}else if(t===M.map){if(r.size!==n.size)return!1;for(const[t,e]of Map.prototype.entries.call(r)){if(void 0===e&&!Map.prototype.has.call(n,t))return!1;if(!s(e,Map.prototype.get.call(n,t),o,i))return!1}}else if(t===M.error&&(r.name!==n.name||r.message!==n.message))return!1;const l=u(r),h=u(n);if((r!==l||n!==h)&&!s(l,h,o,i))return!1;const p=f(r);if(!o.part&&p.length!==f(n).length&&!o.skip)return!1;let y=0;for(const e of p)if(o.skip&&o.skip.includes(e))void 0===n[e]&&++y;else{if(!a(n,e))return!1;if(!s(r[e],n[e],o,i))return!1}if(!o.part&&p.length-y!==f(n).length)return!1;if(!1!==o.symbols){const t=c(r),e=new Set(c(n));for(const u of t){if(!o.skip||!o.skip.includes(u))if(a(r,u)){if(!a(n,u))return!1;if(!s(r[u],n[u],o,i))return!1}else if(a(n,u))return!1;e.delete(u)}for(const r of e)if(a(n,r))return!1}return!0},e.SeenEntry=class{constructor(t,e){this.obj=t,this.ref=e}isSame(t,e){return this.obj===t&&this.ref===e}}}).call(this)}).call(this,n({}).Buffer);var nt,ot=function(t){return t.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")};const it={};nt=function(t,e,r={}){return"object"!=typeof e&&(e=[e]),E(!Array.isArray(e)||e.length,"Values array cannot be empty"),"string"==typeof t?it.string(t,e,r):Array.isArray(t)?it.array(t,e,r):(E("object"==typeof t,"Reference must be string or an object"),it.object(t,e,r))},it.array=function(t,e,r){if(Array.isArray(e)||(e=[e]),!t.length)return!1;if(r.only&&r.once&&t.length!==e.length)return!1;let n;const o=new Map;for(const s of e)if(r.deep&&s&&"object"==typeof s){n=n||it.compare(r);let t=!1;for(const[e,r]of o.entries())if(n(e,s)){++r.allowed,t=!0;break}t||o.set(s,{allowed:1,hits:0})}else{const t=o.get(s);t?++t.allowed:o.set(s,{allowed:1,hits:0})}let i=0;for(const s of t){let t;if(r.deep&&s&&"object"==typeof s){n=n||it.compare(r);for(const[e,r]of o.entries())if(n(e,s)){t=r;break}}else t=o.get(s);if(t&&(++t.hits,++i,r.once&&t.hits>t.allowed))return!1}if(r.only&&i!==t.length)return!1;for(const s of o.values())if(s.hits!==s.allowed&&s.hits<s.allowed&&!r.part)return!1;return!!i},it.object=function(t,e,r){E(void 0===r.once,"Cannot use option once with object");const n=C.keys(t,r);if(!n.length)return!1;if(Array.isArray(e))return it.array(n,e,r);const o=Object.getOwnPropertySymbols(e).filter(t=>e.propertyIsEnumerable(t)),i=[...Object.keys(e),...o],s=it.compare(r),u=new Set(i);for(const a of n)if(u.has(a)){if(!s(e[a],t[a]))return!1;u.delete(a)}else if(r.only)return!1;return!u.size||!!r.part&&u.size<i.length},it.string=function(t,e,r){if(""===t)return 1===e.length&&""===e[0]||!r.once&&!e.some(t=>""!==t);const n=new Map,o=[];for(const a of e)if(E("string"==typeof a,"Cannot compare string reference to non-string value"),a){const t=n.get(a);t?++t.allowed:(n.set(a,{allowed:1,hits:0}),o.push(ot(a)))}else if(r.once||r.only)return!1;if(!o.length)return!0;const i=new RegExp(`(${o.join("|")})`,"g"),s=t.replace(i,(t,e)=>(++n.get(e).hits,""));if(r.only&&s)return!1;let u=!1;for(const a of n.values())if(a.hits&&(u=!0),a.hits!==a.allowed){if(a.hits<a.allowed&&!r.part)return!1;if(r.once)return!1}return!!u},it.compare=function(t){if(!t.deep)return it.shallow;const e=void 0!==t.only,r=void 0!==t.part,n={prototype:e?t.only:!!r&&!t.part,part:e?!t.only:!!r&&t.part};return(t,e)=>rt(t,e,n)},it.shallow=function(t,e){return t===e};var st;const ut={};st=function(t){if(!t)return"";let e="";for(let r=0;r<t.length;++r){const n=t.charCodeAt(r);ut.isSafe(n)?e+=t[r]:e+=ut.escapeHtmlChar(n)}return e},ut.escapeHtmlChar=function(t){const e=ut.namedHtml[t];return void 0!==e?e:t>=256?"&#"+t+";":`&#x${t.toString(16).padStart(2,"0")};`},ut.isSafe=function(t){return void 0!==ut.safeCharCodes[t]},ut.namedHtml={38:"&amp;",60:"&lt;",62:"&gt;",34:"&quot;",160:"&nbsp;",162:"&cent;",163:"&pound;",164:"&curren;",169:"&copy;",174:"&reg;"},ut.safeCharCodes=function(){const t={};for(let e=32;e<123;++e)(e>=97||e>=65&&e<=90||e>=48&&e<=57||32===e||46===e||44===e||45===e||58===e||95===e)&&(t[e]=null);return t}();const at={};var ft,ct=at.flatten=function(t,e){const r=e||[];for(let n=0;n<t.length;++n)Array.isArray(t[n])?at.flatten(t[n],r):r.push(t[n]);return r};const lt={};ft=function(t,e,r={}){if(!t||!e)return r.first?null:[];const n=[],o=Array.isArray(t)?new Set(t):t,i=new Set;for(const s of e)if(lt.has(o,s)&&!i.has(s)){if(r.first)return s;n.push(s),i.add(s)}return r.first?null:n},lt.has=function(t,e){return"function"==typeof t.has?t.has(e):void 0!==t[e]};var ht={};ht.applyToDefaults=R,ht.assert=E,ht.Bench=tt,ht.block=function(){return new Promise(et)},ht.clone=P,ht.contain=nt,ht.deepEqual=rt,ht.Error=w,ht.escapeHeaderAttribute=function(t){return E(/^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~\"\\]*$/.test(t),"Bad attribute value ("+t+")"),t.replace(/\\/g,"\\\\").replace(/\"/g,'\\"')},ht.escapeHtml=st,ht.escapeJson=function(t){if(!t)return"";let e;return t.replace(/[<>&\u2028\u2029]/g,t=>60===(e=t.charCodeAt(0))?"\\u003c":62===e?"\\u003e":38===e?"\\u0026":8232===e?"\\u2028":"\\u2029")},ht.escapeRegex=ot,ht.flatten=ct,ht.ignore=et,ht.intersect=ft,ht.isPromise=function(t){return!!t&&"function"==typeof t.then},ht.merge=U,ht.once=function(t){if(t._hoekOnce)return t;let e=!1;const r=function(...r){e||(e=!0,t(...r))};return r._hoekOnce=!0,r},ht.reach=b,ht.reachTemplate=function(t,e,r){return e.replace(/{([^{}]+)}/g,(e,n)=>{const o=b(t,n,r);return null==o?"":o})},ht.stringify=m,ht.wait=function(t,e){if("number"!=typeof t&&void 0!==t)throw new TypeError("Timeout must be a number");return new Promise(r=>setTimeout(r,t,e))};var pt={exports:{}};(function(t){(function(){!function(e){"object"==typeof pt.exports?pt.exports=e():("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:this).Nua=e()}((function(){return function(t,e,r){var n=(r=r||{}).depth||Number.MAX_VALUE,o=r.setter,i=!!r.preserve;"object"==typeof t&&"object"==typeof e&&function t(e,r,s){if(!(null==e||null==r||n<=s)){var u=s+1;if(Array.isArray(e)&&Array.isArray(r)){for(var a=0;a<e.length;a++)"object"==typeof e[a]?t(e[a],r[a],u):o?o(e,a,r[a]):e[a]=r[a];for(;a<r.length;a++)o?o(e,a,r[a]):e[a]=r[a];e.splice(r.length)}else{for(var f=Object.keys(e),c=0;c<f.length;c++){var l=e[f[c]],h=r[f[c]];"object"==(null===l?"null":typeof l)&&"object"==(null===h?"null":typeof h)?t(l,h,u):void 0===h?i||delete e[f[c]]:o?o(e,f[c],h):e[f[c]]=h}for(var p=Object.keys(r),y=0;y<p.length;y++)void 0===e[p[y]]&&(o?(o(e,p[y],r[p[y]]),null==r[p[y]]||!Array.isArray(r[p[y]])&&"object"!=typeof r[p[y]]||t(e[p[y]],r[p[y]],u)):e[p[y]]=r[p[y]])}}}(t,e,0)}}))}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),pt=pt.exports;var yt={},gt=this&&this.__createBinding||(Object.create?function(t,e,r,n){void 0===n&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]}),dt=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),vt=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&gt(e,t,r);return dt(e,t),e},mt=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(yt,"__esModule",{value:!0}),yt.LegacyOrdu=yt.Task=yt.Ordu=void 0;const wt=vt(ht),bt=mt(pt);class Et{constructor(t){var e;this.runid=null==t.id?(""+Math.random()).substring(2):t.id,this.name=t.name||"task"+Et.count++,this.before=t.before,this.after=t.after,this.exec=t.exec||(t=>{}),this.if=t.if||void 0,this.active=null==t.active||t.active,this.meta=Object.assign(t.meta||{},{when:Date.now(),from:null===(e=t.meta)||void 0===e?void 0:e.from})}}yt.Task=Et,Et.count=0;class _t{constructor(t,e,r,n){this.op="not-defined",this.task=t,this.name=t.name,this.start=Date.now(),this.end=Number.MAX_SAFE_INTEGER,this.index=e,this.total=r,this.async=!1,this.runid=n}update(t){t=null==t?{}:t,this.out=null==t.out?{}:t.out,this.err=t instanceof Error?t:t.err,this.op=null!=this.err?"stop":"string"==typeof t.op?t.op:"next",this.why=t.why||""}}function At(t,e){for(var r=0;r<e.length;++r)if(-1===t.indexOf(e[r]))return!1;return!0}return yt.Ordu=class extends o.EventEmitter{constructor(t){super(),this.task={},this._opts={debug:!1,...t},this._tasks=[],this._operator_map={next:()=>({stop:!1}),skip:()=>({stop:!1}),stop:(t,e,r)=>((0,bt.default)(r,t.out,{preserve:!0}),{stop:!0,err:t.err}),merge:(t,e,r)=>((0,bt.default)(r,t.out,{preserve:!0}),{stop:!1})}}operator(t,e){let r="string"==typeof t?t:t.name;this._operator_map[r]=e||t}operators(){return this._operator_map}add(t,e){let r;var n;if(this._opts.debug&&(r=null==(n=new Error)?[]:(n.stack||"").split(/\n/).slice(4).map(t=>t.substring(4))),"function"==typeof t){let n=e=e||{};n.exec=t,n.name=t.name?t.name:n.name,this._add_task(n,r)}else if(Array.isArray(t))for(var o=0;o<t.length;o++){let e=t[o];"function"==typeof t[o]&&(e={name:t[o].name,exec:t[o]}),this._add_task(e,r)}else this._add_task(t,r);return this}_add_task(t,e){e&&(t.meta=t.meta||{},t.meta.from=Object.assign(t.meta.from||{},{callpoint$:e}));let r=new Et(t),n=0;for(;n<this._tasks.length&&(null==r.before||this._tasks[n].name!==r.before);n++)if(null!=r.after&&this._tasks[n].name===r.after){n++;break}this._tasks.splice(n,0,r),this.task[r.name]=r}execSync(t,e,r){return this._execImpl(t,e,r)}async exec(t,e,r){return new Promise(n=>{this._execImpl(t,e,r,n)})}_execImpl(t,e,r,n){const o=this;let i=(r=null==r?{}:r).runid||(Math.random()+"").substring(2),s=Date.now(),u=[...o._tasks],a={ctx:t||{},data:e||{}},f=[],c=0,l=0,h=void 0;return p(0);function p(t){if(t>=u.length){let t=function(){let t=h?h.err:null,e={tasklog:f,task:t?u[l]:void 0,taskcount:c,tasktotal:u.length,start:s,end:Date.now(),err:t,data:a.data};return r.done&&r.done(e),e}();return n?n(t):t}l=t;let e,p,g=u[t],d=new _t(g,t,u.length,i);if(g.active&&o._task_if(g,a.data))try{c++;let r=Object.assign({task:g},a);(e=g.exec(r))instanceof Promise?(d.async=!0,e.then(t=>p=t).catch(t=>p=t).finally(()=>y(t,g,p,d))):p=e}catch(v){p=v}else p={op:"skip"};if(!d.async)return y(t,g,p,d)}function y(t,e,r,n){n.end=Date.now(),n.update(r),o.emit("task-result",n);let i={stop:!1,err:void 0,async:!1};try{let r=o._operate(n,a.ctx,a.data);r instanceof Promise?(i.async=!0,r.then(t=>{Object.assign(i,t)}).catch(t=>{i.stop=!0,i.err=t}).finally(()=>{g(t,e,n,i)})):(i=r).async=!1}catch(s){i.stop=!0,i.err=s}if(!i.async)return g(t,e,n,i)}function g(t,e,r,n){h=n;let i={name:e.name,op:r.op,task:e,result:r,operate:n,data:o._opts.debug?JSON.parse(JSON.stringify(a.data)):void 0};return f.push(i),o.emit("task-end",i),n.stop?t=u.length:++t,p(t)}}tasks(){return[...this._tasks]}_operate(t,e,r){if(t.err)return{stop:!0,err:t.err,async:!1};let n=this._operator_map[t.op];return n?n(t,e,r):{stop:!0,err:new Error("Unknown operation: "+t.op),async:!1}}_task_if(t,e){if(t.if){let r=t.if;return Object.keys(r).reduce((t,n)=>{let o=wt.reach(e,n);return t&&wt.contain({$:o},{$:r[n]},{deep:!0})},!0)}return!0}},yt.LegacyOrdu=function(t){var e={};(t=t||{}).name=t.name||"ordu0",e.add=function(n,o){return(o=o||n).name||Object.defineProperty(o,"name",{value:t.name+"_task"+r.length}),o.tags=n.tags||[],r.push(o),e},e.process=function(){var t=arguments.length,e=0<t&&arguments[--t],n=0<t&&arguments[--t],o=0<t&&arguments[--t];e=e||{},n=n||{},(o=o||{}).tags=o.tags||[];for(var i=0;i<r.length;++i){var s=r[i];if(!(0<o.tags.length)||At(s.tags,o.tags)){var u=i,a=s.name;n.index$=u,n.taskname$=a;var f=s(n,e);if(f)return f.index$=u,f.taskname$=a,f.ctxt$=n,f.data$=e,f}}return null},e.tasknames=function(){return r.map((function(t){return t.name}))},e.taskdetails=function(){return r.map((function(t){return t.name+":{tags:"+t.tags+"}"}))},e.toString=function(){return t.name+":["+e.tasknames()+"]"};var r=[];return e},yt}));
Severity: Major
Found in test-web/test-web.js and 1 other location - About 1 hr to fix
test-web/test-web.js on lines 4214..4214

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

    if (message !== null) {
        const error = err.message || '';
        this.assert(typeof message === 'string' ? error === message : error.match(message), 'be an error with specified message', error, message);
    }
Severity: Major
Found in test-web/test-web.js and 2 other locations - About 1 hr to fix
test-web/test-web.js on lines 4632..4635
test-web/test-web.js on lines 4675..4678

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 64.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

        if (message !== null) {
            const error = err.message || '';
            this.assert(typeof message === 'string' ? error === message : error.match(message), 'throw an error with specified message', error, message);
        }
Severity: Major
Found in test-web/test-web.js and 2 other locations - About 1 hr to fix
test-web/test-web.js on lines 4423..4426
test-web/test-web.js on lines 4675..4678

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 64.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

            if (message !== null) {
                const error = thrown.message || '';
                this.assert(typeof message === 'string' ? error === message : error.match(message), 'reject with an error with specified message', error, message);
            }
Severity: Major
Found in test-web/test-web.js and 2 other locations - About 1 hr to fix
test-web/test-web.js on lines 4423..4426
test-web/test-web.js on lines 4632..4635

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 64.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

internals.typeMap = new Map([
    ['[object Error]', exports.error],
    ['[object Map]', exports.map],
    ['[object Promise]', exports.promise],
    ['[object Set]', exports.set],
Severity: Major
Found in test-web/test-web.js and 1 other location - About 1 hr to fix
test-web/test-web.js on lines 4214..4214

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 62.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

internals.between = function (from, to) {

    return this.assert(this._ref > from && this._ref < to, 'be between ' + from + '..' + to);
};
Severity: Major
Found in test-web/test-web.js and 1 other location - About 1 hr to fix
test-web/test-web.js on lines 4560..4563

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 62.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

internals.within = function (from, to) {

    return this.assert(this._ref >= from && this._ref <= to, 'be within ' + from + '..' + to);
};
Severity: Major
Found in test-web/test-web.js and 1 other location - About 1 hr to fix
test-web/test-web.js on lines 4568..4571

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 62.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

Object.defineProperty(Buffer.prototype, 'offset', {
  enumerable: true,
  get: function () {
    if (!Buffer.isBuffer(this)) return undefined
    return this.byteOffset
Severity: Major
Found in test-web/test-web.js and 1 other location - About 1 hr to fix
test-web/test-web.js on lines 264..270

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 57.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

Object.defineProperty(Buffer.prototype, 'parent', {
  enumerable: true,
  get: function () {
    if (!Buffer.isBuffer(this)) return undefined
    return this.buffer
Severity: Major
Found in test-web/test-web.js and 1 other location - About 1 hr to fix
test-web/test-web.js on lines 272..278

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 57.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

module.exports = function (...args) {

    try {
        return JSON.stringify.apply(null, args);
    }
Severity: Minor
Found in test-web/test-web.js and 1 other location - About 55 mins to fix
test-web/test-web.js on lines 4214..4214

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 54.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  return (this[offset] << 24) |
    (this[offset + 1] << 16) |
    (this[offset + 2] << 8) |
    (this[offset + 3])
Severity: Minor
Found in test-web/test-web.js and 1 other location - About 55 mins to fix
test-web/test-web.js on lines 4214..4214

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 53.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    parts.push(
      lookup[tmp >> 10] +
      lookup[(tmp >> 4) & 0x3F] +
      lookup[(tmp << 2) & 0x3F] +
      '='
Severity: Minor
Found in test-web/test-web.js and 1 other location - About 55 mins to fix
test-web/test-web.js on lines 4214..4214

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 53.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

function checkIEEE754 (buf, value, offset, ext, max, min) {
  if (offset + ext > buf.length) throw new RangeError('Index out of range')
  if (offset < 0) throw new RangeError('Index out of range')
}
Severity: Minor
Found in test-web/test-web.js and 1 other location - About 50 mins to fix
test-web/test-web.js on lines 4214..4214

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 52.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  if (start < 0) {
    start += len
    if (start < 0) start = 0
  } else if (start > len) {
    start = len
Severity: Minor
Found in test-web/test-web.js and 1 other location - About 50 mins to fix
test-web/test-web.js on lines 1295..1300

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 52.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    try {
        if (typeof clearTimeout === 'function') {
            cachedClearTimeout = clearTimeout;
        } else {
            cachedClearTimeout = defaultClearTimeout;
Severity: Minor
Found in test-web/test-web.js and 1 other location - About 50 mins to fix
test-web/test-web.js on lines 2846..2854

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 52.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  if (end < 0) {
    end += len
    if (end < 0) end = 0
  } else if (end > len) {
    end = len
Severity: Minor
Found in test-web/test-web.js and 1 other location - About 50 mins to fix
test-web/test-web.js on lines 1288..1293

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 52.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    try {
        if (typeof setTimeout === 'function') {
            cachedSetTimeout = setTimeout;
        } else {
            cachedSetTimeout = defaultSetTimout;
Severity: Minor
Found in test-web/test-web.js and 1 other location - About 50 mins to fix
test-web/test-web.js on lines 2855..2863

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 52.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Severity
Category
Status
Source
Language