This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Removes the minus sign from the beginning of the string | |
| * | |
| * @param str | |
| * @returns an array with the first item as true if a minus | |
| * was found and the string minus the minus sign. | |
| */ | |
| function stripSign(str) { | |
| // Check if it has a minus sign | |
| let hasMinus = str.charAt(0) === '-'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Fraction = { | |
| convert: function( value, opts ) { | |
| var frac; | |
| if( value === 0 ) { | |
| frac = [ 0, 1]; | |
| } | |
| else { | |
| if( value < 1e-6 || value > 1e20) { | |
| var qc = this.quickConversion( Number( value ) ); | |
| if( qc[1] <= 1e20 ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * This method gets between a bracket and returns what's between the brackets only | |
| * after it's been balanced. This can be done with a regex however is microsecond | |
| * optimizations aren't too important then this becomes a more versatile solution which | |
| * can accept a multitude of brackets and braces. | |
| * @param {String} ob The opening bracket or brace | |
| * @param {String} cb The closing bracket or brace | |
| * @param {String} str The string containing the brackets | |
| * @param {Integer} start The starting index from where to start searching | |
| * @example getBetweenBrackets('(',')', 'all_of_this(but((I_want_this)))') |
NewerOlder