From 8a883b6a24a5ce273bcea45a634f44e6334950ca Mon Sep 17 00:00:00 2001 From: 30secondsofcode <30secondsofcode@gmail.com> Date: Tue, 16 Oct 2018 17:33:35 +0000 Subject: [PATCH] Travis build: 652 --- docs/archive.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/archive.html b/docs/archive.html index 67e98c523..3d947fa9c 100644 --- a/docs/archive.html +++ b/docs/archive.html @@ -85,6 +85,8 @@ };
binarySearch([1, 4, 6, 7, 12, 13, 15, 18, 19, 20, 22, 24], 6); // 2
 binarySearch([1, 4, 6, 7, 12, 13, 15, 18, 19, 20, 22, 24], 21); // -1
+

celsiusToFahrenheit

Celsius to Fahrenheit temperature conversion.

Follows the conversion formula F = 1.8C + 32.

const celsiusToFahrenheit = degrees => 1.8 * degrees + 32;
+
celsiusToFahrenheit(33) // 91.4
 

cleanObj

Removes any properties except the ones specified from a JSON object.

Use Object.keys() method to loop over given JSON object and deleting keys that are not included in given array. If you pass a special key,childIndicator, it will search deeply apply the function to inner objects, too.

const cleanObj = (obj, keysToKeep = [], childIndicator) => {
   Object.keys(obj).forEach(key => {
     if (key === childIndicator) {
@@ -125,6 +127,8 @@
 factors(12, true); // [2,3]
 factors(-12); // [2, -2, 3, -3, 4, -4, 6, -6, 12, -12]
 factors(-12, true); // [2,3]
+

fahrenheitToCelsius

Fahrenheit to Celsius temperature conversion.

Follows the conversion formula C = (F - 32) * 5/9.

const fahrenheitToCelsius = degrees => (degrees - 32) * 5/9;
+
fahrenheitToCelsius(32); // 0
 

fibonacciCountUntilNum

Returns the number of fibonnacci numbers up to num(0 and num inclusive).

Use a mathematical formula to calculate the number of fibonacci numbers until num.

const fibonacciCountUntilNum = num =>
   Math.ceil(Math.log(num * Math.sqrt(5) + 1 / 2) / Math.log((Math.sqrt(5) + 1) / 2));
 
fibonacciCountUntilNum(10); // 7