si-funciona 2.3.0 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/browser/siFunciona.js +6 -3
- package/browser/siFunciona.min.js +1 -1
- package/dist/helpers/numbers/greatestCommonDivisor.d.ts +1 -1
- package/dist/helpers/numbers/greatestCommonDivisor.js +1 -1
- package/dist/helpers/numbers/simplestRatio.js +5 -2
- package/dist/helpers/numbers/simplestRatio.min.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -608,7 +608,7 @@ Helper for calculating the multiplier that would make each number relative to ea
|
|
|
608
608
|
<a name="module_numberHelpers.greatestCommonDivisor"></a>
|
|
609
609
|
|
|
610
610
|
### numberHelpers.greatestCommonDivisor(num1, num2) ⇒ <code>number</code>
|
|
611
|
-
Return the highest number
|
|
611
|
+
Return the highest number that can be divided into both numbers.
|
|
612
612
|
|
|
613
613
|
**Kind**: static method of [<code>numberHelpers</code>](#module_numberHelpers)
|
|
614
614
|
|
package/browser/siFunciona.js
CHANGED
|
@@ -1477,7 +1477,7 @@
|
|
|
1477
1477
|
exports.default = void 0
|
|
1478
1478
|
require('core-js/stable')
|
|
1479
1479
|
/**
|
|
1480
|
-
* Return the highest number
|
|
1480
|
+
* Return the highest number that can be divided into both numbers.
|
|
1481
1481
|
* @memberOf module:numberHelpers
|
|
1482
1482
|
* @param {number} num1 - First number to assess
|
|
1483
1483
|
* @param {number} num2 - Second number to compare for common divisor
|
|
@@ -1604,8 +1604,11 @@
|
|
|
1604
1604
|
if (numbers.length === 0) {
|
|
1605
1605
|
return []
|
|
1606
1606
|
}
|
|
1607
|
-
|
|
1608
|
-
|
|
1607
|
+
let commonDivisor = numbers.reduce((num1, num2) => (0, _greatestCommonDivisor.default)(num1, num2), 0)
|
|
1608
|
+
// Set to positive so that when we divide the numbers they retain their +/-
|
|
1609
|
+
commonDivisor = Math.abs(commonDivisor)
|
|
1610
|
+
// Simplify the numbers, handle zero
|
|
1611
|
+
return numbers.map(num => commonDivisor === 0 ? 0 : num / commonDivisor)
|
|
1609
1612
|
}
|
|
1610
1613
|
var _default = exports.default = simplestRatio
|
|
1611
1614
|
}, { './greatestCommonDivisor': 38, 'core-js/stable': 713 }],
|