app/assets/javascripts/i18n.js in i18n-js-3.0.0.rc2 vs app/assets/javascripts/i18n.js in i18n-js-3.0.0.rc3

- old
+ new

@@ -353,30 +353,22 @@ number = number.substr(0, number.length -3); } formattedNumber = buffer.join(options.delimiter); - if (options.precision > 0) { - formattedNumber += options.separator + parts[1]; + if (options.strip_insignificant_zeros && precision) { + precision = precision.replace(/0+$/, ""); } + if (options.precision > 0 && precision) { + formattedNumber += options.separator + precision; + } + if (negative) { formattedNumber = "-" + formattedNumber; } - if (options.strip_insignificant_zeros) { - var regex = { - separator: new RegExp(options.separator.replace(/\./, "\\.") + "$") - , zeros: /0+$/ - }; - - formattedNumber = formattedNumber - .replace(regex.zeros, "") - .replace(regex.separator, "") - ; - } - return formattedNumber; }; // Format currency with localization rules. // The options will be retrieved from the `number.currency.format` and @@ -657,43 +649,5 @@ // Set aliases, so we can save some typing. I18n.t = I18n.translate; I18n.l = I18n.localize; I18n.p = I18n.pluralize; })(typeof(exports) === "undefined" ? this["I18n"] = {} : exports); - -// https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf -if (!Array.prototype.indexOf) { - Array.prototype.indexOf = function(searchElement /*, fromIndex */) { - "use strict"; - - if (this === void 0 || this === null) - throw new TypeError(); - - var t = Object(this); - var len = t.length >>> 0; - if (len === 0) - return -1; - - var n = 0; - if (arguments.length > 0) { - n = Number(arguments[1]); - if (n !== n) // shortcut for verifying if it's NaN - n = 0; - else if (n !== 0 && n !== (Infinity) && n !== -(Infinity)) - n = (n > 0 || -1) * Math.floor(Math.abs(n)); - } - - if (n >= len) - return -1; - - var k = n >= 0 - ? n - : Math.max(len - Math.abs(n), 0); - - for (; k < len; k++) { - if (k in t && t[k] === searchElement) - return k; - } - return -1; - }; -} -; \ No newline at end of file