|
@@ -25,10 +25,22 @@ function DeepClone(toClone) {
|
|
* @returns {boolean} Whether the value in that number's place is non-zero
|
|
* @returns {boolean} Whether the value in that number's place is non-zero
|
|
*/
|
|
*/
|
|
function DecimalPlaceIsNonZero(input, place) {
|
|
function DecimalPlaceIsNonZero(input, place) {
|
|
- return !!Math.floor((input / (10 ** place)) % 10);
|
|
|
|
|
|
+ return !!GetDecimalInPlace(input, place);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Get the digit in a given place of a decimal number
|
|
|
|
+ *
|
|
|
|
+ * @param {number} input The number to check
|
|
|
|
+ * @param {number} place The power of 10 to check against
|
|
|
|
+ * @returns {number} The number at the specified place in the input
|
|
|
|
+ */
|
|
|
|
+function GetDecimalInPlace(input, place) {
|
|
|
|
+ return Math.floor((input / (10 ** place)) % 10);
|
|
}
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
module.exports = {
|
|
DeepClone: DeepClone,
|
|
DeepClone: DeepClone,
|
|
DecimalPlaceIsNonZero: DecimalPlaceIsNonZero,
|
|
DecimalPlaceIsNonZero: DecimalPlaceIsNonZero,
|
|
|
|
+ GetDecimalInPlace: GetDecimalInPlace,
|
|
};
|
|
};
|