From a99d9f769d8b90c113fca8b1e1f14adc0473e295 Mon Sep 17 00:00:00 2001 From: 30secondsofcode <30secondsofcode@gmail.com> Date: Wed, 3 Oct 2018 05:03:56 +0000 Subject: [PATCH] Travis build: 581 --- docs/archive.html | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/docs/archive.html b/docs/archive.html index f241a9be8..37d61d9e6 100644 --- a/docs/archive.html +++ b/docs/archive.html @@ -180,14 +180,12 @@ isArmstrongNumber(56); // false

isSimilar

Determines if the pattern matches with str.

Use String.toLowerCase() to convert both strings to lowercase, then loop through str and determine if it contains all characters of pattern and in the correct order. Adapted from here.

const isSimilar = (pattern, str) =>
   [...str].reduce(
-    (matchIndex, char) =>
-      char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase()
-        ? matchIndex + 1
-        : matchIndex,
-    0
-  ) === pattern.length
-    ? true
-    : false;
+      (matchIndex, char) =>
+          char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase()
+              ? matchIndex + 1
+              : matchIndex,
+      0
+  ) === pattern.length;
 
isSimilar('rt','Rohit'); // true
 isSimilar('tr','Rohit'); // false
 

JSONToDate

Converts a JSON object to a date.

Use Date(), to convert dates in JSON format to readable format (dd/mm/yyyy).

const JSONToDate = arr => {