Completed
Push — master ( 1fc2ad...b8a2ae )
by Samson
02:50
created

n.t   B

Complexity

Conditions 8
Paths 4

Size

Total Lines 1
Code Lines 1

Duplication

Lines 2
Ratio 200 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 8
eloc 1
nc 4
nop 2
dl 2
loc 1
rs 7.3333
c 1
b 0
f 0
1
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,r,o;return t=e,(r=[{key:"isZero",value:function(e){return 0===e}},{key:"isGeezNumberHundred",value:function(e){return this.isGeezNumber(e,100)}},{key:"isGeezNumber",value:function(t,n){return t===e.GEEZ_NUMBERS[n]}},{key:"isGeezNumberOne",value:function(e){return this.isGeezNumber(e,1)}},{key:"isGeezNumberTenThousand",value:function(e){return this.isGeezNumber(e,1e4)}}])&&n(t.prototype,r),o&&n(t,o),e}(),Object.defineProperty(e.exports,"EMPTY_CHARACTER",{value:"",writable:!1,enumerable:!0,configurable:!1}),Object.defineProperty(e.exports,"GEEZ_NUMBERS",{value:{0:"",1:"፩",2:"፪",3:"፫",4:"፬",5:"፭",6:"፮",7:"፯",8:"፰",9:"፱",10:"፲",20:"፳",30:"፴",40:"፵",50:"፶",60:"፷",70:"፸",80:"፹",90:"፺",100:"፻",10000:"፼"},writable:!1,enumerable:!0,configurable:!1})},function(e,t,n){var r=n(2);window.Geezify=r},function(e,t,n){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=n(3),u=n(5);e.exports=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.geez_converter=t,this.ascii_converter=n}var t,n,i;return t=e,i=[{key:"create",value:function(){return new e(new o,new u)}}],(n=[{key:"toGeez",value:function(e){return this.geez_converter.convert(e)}},{key:"toAscii",value:function(e){return this.ascii_converter.convert(e)}},{key:"getGeezConverter",value:function(){return this.geez_converter}},{key:"setGeezConverter",value:function(e){this.geez_converter=e}},{key:"getAsciiConverter",value:function(){return this.ascii_converter}},{key:"setAsciiConverter",value:function(e){this.ascii_converter=e}}])&&r(t.prototype,n),i&&r(t,i),e}()},function(e,t,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var c=n(0),f=n(4);e.exports=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,i(t).apply(this,arguments))}var n,r,s;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(t,c),n=t,(r=[{key:"convert",value:function(e){for(var t=this.prepareForConversion(e),n=t.length,r=c.EMPTY_CHARACTER,o=0;o<n;o+=2)r+=this.parseEachTwoCharactersBlock(t,o,n);return r}},{key:"prepareForConversion",value:function(e){var t=this.validateAsciiNumber(e),n=(t="".concat(t)).length;return this.prependSpaceIfLengthIsEven(t,n)}},{key:"validateAsciiNumber",value:function(e){var t=parseInt(e);if(Number.isNaN(t)||"".concat(t)!=="".concat(e)||t<1)throw new f(e);return e}},{key:"prependSpaceIfLengthIsEven",value:function(e,t){return this.isOdd(t)?" ".concat(e):e}},{key:"isOdd",value:function(e){return!this.isEven(e)}},{key:"isEven",value:function(e){return e%2==0}},{key:"parseEachTwoCharactersBlock",value:function(e,t,n){var r=this.getGeezNumberOfTheBlock(e,t),o=this.getBet(n,t),u=this.getGeezSeparator(o);return this.combineBlockAndSeparator(r,u,t)}},{key:"getGeezNumberOfTheBlock",value:function(e,t){var n=this.getBlock(e,t),r=Number.isNaN(parseInt(n[0]))?0:parseInt(n[0]),o=parseInt(n[1]);return c.GEEZ_NUMBERS[10*r]+c.GEEZ_NUMBERS[o]}},{key:"getBlock",value:function(e,t){return e.substr(t,2)}},{key:"getBet",value:function(e,t){var n=e-1-t;return Math.floor(n/2)}},{key:"getGeezSeparator",value:function(e){return this.isZero(e)?c.EMPTY_CHARACTER:this.isOdd(e)?c.GEEZ_NUMBERS[100]:c.GEEZ_NUMBERS[1e4]}},{key:"combineBlockAndSeparator",value:function(e,t,n){return this.shouldRemoveGeezSeparator(e,t)&&(t=c.EMPTY_CHARACTER),this.shouldRemoveGeezNumberBlock(e,t,n)&&(e=c.EMPTY_CHARACTER),e+t}},{key:"shouldRemoveGeezSeparator",value:function(e,t){return 0===e.trim().length&&this.isGeezNumberHundred(t)}},{key:"shouldRemoveGeezNumberBlock",value:function(e,t,n){return this.isOneHundred(e,t)||this.isLeadingTenThousand(e,t,n)}},{key:"isOneHundred",value:function(e,t){return this.isGeezNumberHundred(t)&&this.isGeezNumberOne(e)}},{key:"isLeadingTenThousand",value:function(e,t,n){return this.isZero(n)&&this.isGeezNumberOne(e)&&this.isGeezNumberTenThousand(t)}}])&&o(n.prototype,r),s&&o(n,s),t}()},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function o(e){var t="function"==typeof Map?new Map:void 0;return(o=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return u(e,arguments,a(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,e)})(e)}function u(e,t,n){return(u=function(){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(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&i(o,n.prototype),o}).apply(null,arguments)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}e.exports=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r(this,a(t).call(this,"Not an integer!, ".concat(n(e)," given.")))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(t,o(Error)),t}()},function(e,t,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var c=n(0),f=n(6),s=n(8);e.exports=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),u(this,i(t).apply(this,arguments))}var n,r,l;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(t,c),n=t,(r=[{key:"convert",value:function(e){var t=this.parse(e);return this.calculate(t)}},{key:"parse",value:function(e){var t=new f(e);return t.parse(),t.getParsed()}},{key:"calculate",value:function(e){var t=new s(e);return t.calculate(),t.getCalculated()}}])&&o(n.prototype,r),l&&o(n,l),t}()},function(e,t,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var u=n(0),i=n(7);e.exports=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.setGeezNumber(t),this.parsed=null}var t,n,a;return t=e,(n=[{key:"setGeezNumber",value:function(e){if(r(e)!==r("something"))throw new i(r(e));this.geez_number=e}},{key:"getParsed",value:function(){return this.parsed}},{key:"parse",value:function(){this.parsed=[];for(var e=0,t=this.getLength(this.geez_number),n=0;n<t;n++)e=this.parseCharacter(n,e);this.pushToQueue(e,1)}},{key:"getLength",value:function(e){return e.length}},{key:"parseCharacter",value:function(e,t){var n=this.parseGeezAtIndex(e);return this.isNotGeezSeparator(n)?t+=n:(this.pushToQueue(t,n),t=0),t}},{key:"parseGeezAtIndex",value:function(e){var t=this.getCharacterAt(this.geez_number,e);return parseInt(this.getAsciiNumber(t))}},{key:"getCharacterAt",value:function(e,t){return e.charAt(t)}},{key:"getAsciiNumber",value:function(e){var t=Object.values(u.GEEZ_NUMBERS).indexOf(e);if(-1===t)throw new i(e);return Object.keys(u.GEEZ_NUMBERS)[t]}},{key:"isNotGeezSeparator",value:function(e){return e<99}},{key:"pushToQueue",value:function(e,t){this.parsed.push({block:e,separator:t})}}])&&o(t.prototype,n),a&&o(t,a),e}()},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){return!t||"object"!==n(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function o(e){var t="function"==typeof Map?new Map:void 0;return(o=function(e){if(null===e||(n=e,-1===Function.toString.call(n).indexOf("[native code]")))return e;var n;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return u(e,arguments,a(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),i(r,e)})(e)}function u(e,t,n){return(u=function(){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(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&i(o,n.prototype),o}).apply(null,arguments)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}e.exports=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),r(this,a(t).call(this,"Not a geez number!, ".concat(e," given.")))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&i(e,t)}(t,o(Error)),t}()},function(e,t,n){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}n(0);e.exports=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.queue=t,this.total=0,this.sub_total=0}var t,n,o;return t=e,(n=[{key:"calculate",value:function(){var e=this;this.resetSubTotalToZero(),this.queue.forEach(function(t){e.processToken(t)})}},{key:"resetSubTotalToZero",value:function(){this.sub_total=0}},{key:"processToken",value:function(e){var t=e.block,n=e.separator;this.processBySeparator(t,n)}},{key:"processBySeparator",value:function(e,t){switch(t){case 1:this.addToTotal(e);break;case 100:this.updateSubTotal(e);break;case 1e4:this.updateTotal(e)}}},{key:"addToTotal",value:function(e){this.total+=this.sub_total+e,this.resetSubTotalToZero()}},{key:"isLeading",value:function(e){return this.isBlockZero(e)&&this.isSubtotalZero()}},{key:"isBlockZero",value:function(e){return this.isZero(e)}},{key:"isZero",value:function(e){return 0===e}},{key:"isSubtotalZero",value:function(){return this.isZero(this.sub_total)}},{key:"addToSubTotal",value:function(e){this.sub_total+=e}},{key:"isLeadingTenThousand",value:function(e){return this.isTotalZero()&&this.isLeading(e)}},{key:"isTotalZero",value:function(){return this.isZero(this.total)}},{key:"multiplyTotalBy10k",value:function(){this.total*=1e4}},{key:"getCalculated",value:function(){return this.total}},{key:"updateSubTotal",value:function(e){this.isLeading(e)&&(e=1),e*=100,this.addToSubTotal(e)}},{key:"updateTotal",value:function(e){this.isLeadingTenThousand(e)&&(e=1),this.addToTotal(e),this.multiplyTotalBy10k()}}])&&r(t.prototype,n),o&&r(t,o),e}()}]);
0 ignored issues
show
Coding Style Best Practice introduced by
By convention, constructors like e should be capitalized.
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...
Complexity introduced by
A for in loop automatically includes the property of any prototype object, consider checking the key using hasOwnProperty.

When iterating over the keys of an object, this includes not only the keys of the object, but also keys contained in the prototype of that object. It is generally a best practice to check for these keys specifically:

var someObject;
for (var key in someObject) {
    if ( ! someObject.hasOwnProperty(key)) {
        continue; // Skip keys from the prototype.
    }

    doSomethingWith(key);
}
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...
unused-code introduced by
The call to bind does not seem necessary since the function does not use this. Consider calling it directly.
Loading history...
Coding Style Best Practice introduced by
By convention, constructors like f should be capitalized.
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. a is already defined in line 1 as a function. While this will work, it can be very confusing.
Loading history...
Best Practice introduced by
Comparing e % 2 to 0 using the == operator is not safe. Consider using === instead.
Loading history...
introduced by
You have used a bitwise operator & in a condition. Did you maybe want to use the logical operator &&
Loading history...
Coding Style Best Practice introduced by
By convention, constructors like s should be capitalized.
Loading history...
Bug introduced by
The variable s seems to be never initialized.
Loading history...
Bug introduced by
The variable l seems to be never initialized.
Loading history...
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. o is already defined in line 1 as a function. While this will work, it can be very confusing.
Loading history...
Bug introduced by
The variable a seems to be never initialized.
Loading history...
Coding Style Best Practice introduced by
By convention, constructors like u should be capitalized.
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
By convention, constructors like i should be capitalized.
Loading history...
Bug introduced by
The variable o seems to be never initialized.
Loading history...
Coding Style Best Practice introduced by
By convention, constructors like o should be capitalized.
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...
Comprehensibility introduced by
It seems like you are trying to overwrite a function name here. n 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...
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...