From a47f64c89a70259a5283329ac98677881bb7d229 Mon Sep 17 00:00:00 2001 From: Rohit Tanwar Date: Mon, 26 Feb 2018 15:06:47 +0530 Subject: [PATCH] update --- {snippets => snippets_archive}/isSimilar.md | 0 tag_database | 1 - test/isSimilar/isSimilar.js | 5 + test/isSimilar/isSimilar.test.js | 13 ++ test/testlog | 202 +++++++++++--------- 5 files changed, 128 insertions(+), 93 deletions(-) rename {snippets => snippets_archive}/isSimilar.md (100%) create mode 100644 test/isSimilar/isSimilar.js create mode 100644 test/isSimilar/isSimilar.test.js diff --git a/snippets/isSimilar.md b/snippets_archive/isSimilar.md similarity index 100% rename from snippets/isSimilar.md rename to snippets_archive/isSimilar.md diff --git a/tag_database b/tag_database index 412941ddb..df3662150 100644 --- a/tag_database +++ b/tag_database @@ -82,7 +82,6 @@ forOwnRight:object fromCamelCase:string functionName:function,utility functions:object,function -fuzzySearch:string,utility gcd:math,recursion geometricProgression:math get:object diff --git a/test/isSimilar/isSimilar.js b/test/isSimilar/isSimilar.js new file mode 100644 index 000000000..9c4fc3eec --- /dev/null +++ b/test/isSimilar/isSimilar.js @@ -0,0 +1,5 @@ +const isSimilar = (pattern, str) => +[...str].reduce( +(matchIndex, char) => char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase() ? matchIndex + 1 : matchIndex, 0 +) === pattern.length ? true : false; +module.exports = isSimilar; \ No newline at end of file diff --git a/test/isSimilar/isSimilar.test.js b/test/isSimilar/isSimilar.test.js new file mode 100644 index 000000000..bcc980a18 --- /dev/null +++ b/test/isSimilar/isSimilar.test.js @@ -0,0 +1,13 @@ +const test = require('tape'); +const isSimilar = require('./isSimilar.js'); + +test('Testing isSimilar', (t) => { + //For more information on all the methods supported by tape + //Please go to https://github.com/substack/tape + t.true(typeof isSimilar === 'function', 'isSimilar is a Function'); + //t.deepEqual(isSimilar(args..), 'Expected'); + //t.equal(isSimilar(args..), 'Expected'); + //t.false(isSimilar(args..), 'Expected'); + //t.throws(isSimilar(args..), 'Expected'); + t.end(); +}); \ No newline at end of file diff --git a/test/testlog b/test/testlog index a68b12cfd..e0ee56095 100644 --- a/test/testlog +++ b/test/testlog @@ -1,20 +1,20 @@ -Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) +Test log for: Mon Feb 26 2018 15:06:03 GMT+0530 (India Standard Time) -> 30-seconds-of-code@0.0.2 test /home/travis/build/Chalarangelo/30-seconds-of-code +> 30-seconds-of-code@0.0.2 test R:\github\30-seconds-of-code > tape test/**/*.test.js | tap-spec Testing all - ✔ all is a Function - ✔ Returns true for arrays with no falsey values - ✔ Returns false for arrays with 0 - ✔ Returns false for arrays with NaN - ✔ Returns false for arrays with undefined - ✔ Returns false for arrays with null - ✔ Returns false for arrays with empty strings - ✔ Returns true with predicate function - ✔ Returns false with a predicate function + √ all is a Function + √ Returns true for arrays with no falsey values + √ Returns false for arrays with 0 + √ Returns false for arrays with NaN + √ Returns false for arrays with undefined + √ Returns false for arrays with null + √ Returns false for arrays with empty strings + √ Returns true with predicate function + √ Returns false with a predicate function Testing anagrams @@ -25,12 +25,12 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing any - ✔ any is a Function - ✔ Returns true for arrays with at least one truthy value - ✔ Returns false for arrays with no truthy values - ✔ Returns false for arrays with no truthy values - ✔ Returns true with predicate function - ✔ Returns false with a predicate function + √ any is a Function + √ Returns true for arrays with at least one truthy value + √ Returns false for arrays with no truthy values + √ Returns false for arrays with no truthy values + √ Returns true with predicate function + √ Returns false with a predicate function Testing approximatelyEqual @@ -42,8 +42,8 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing arrayToHtmlList - ✔ arrayToHtmlList is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ arrayToHtmlList is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing ary @@ -64,18 +64,18 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing average - ✔ average is a Function - ✔ average(true) returns 0 - ✔ average(false) returns 1 - ✔ average(9, 1) returns 5 - ✔ average(153, 44, 55, 64, 71, 1122, 322774, 2232, 23423, 234, 3631) returns 32163.909090909092 - ✔ average(1, 2, 3) returns 2 - ✔ average(null) returns 0 - ✔ average(1, 2, 3) returns NaN - ✔ average(String) returns NaN - ✔ average({ a: 123}) returns NaN - ✔ average([undefined, 0, string]) returns NaN - ✔ average([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run + √ average is a Function + √ average(true) returns 0 + √ average(false) returns 1 + √ average(9, 1) returns 5 + √ average(153, 44, 55, 64, 71, 1122, 322774, 2232, 23423, 234, 3631) returns 32163.909090909092 + √ average(1, 2, 3) returns 2 + √ average(null) returns 0 + √ average(1, 2, 3) returns NaN + √ average(String) returns NaN + √ average({ a: 123}) returns NaN + √ average([undefined, 0, string]) returns NaN + √ average([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run Testing averageBy @@ -173,8 +173,8 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing chainAsync - ✔ chainAsync is a Function - ✔ Calls all functions in an array + √ chainAsync is a Function + √ Calls all functions in an array Testing chunk @@ -273,18 +273,18 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing createElement - ✔ createElement is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ createElement is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing createEventHub - ✔ createEventHub is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ createEventHub is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing currentURL - ✔ currentURL is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ currentURL is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing curry @@ -315,13 +315,13 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing defaults - ✔ defaults is a Function - ✔ Assigns default values for undefined properties + √ defaults is a Function + √ Assigns default values for undefined properties Testing defer - ✔ defer is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ defer is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing degreesToRads @@ -541,6 +541,8 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing fuzzySearch √ fuzzySearch is a Function + √ Provided examples work + √ Provided examples work Testing gcd @@ -575,13 +577,13 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing getScrollPosition - ✔ getScrollPosition is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ getScrollPosition is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing getStyle - ✔ getStyle is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ getStyle is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing getType @@ -610,13 +612,13 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing hasFlags - ✔ hasFlags is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ hasFlags is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing hashBrowser - ✔ hashBrowser is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ hashBrowser is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing hashNode @@ -643,8 +645,8 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing hide - ✔ hide is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ hide is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing howManyTimes @@ -902,6 +904,10 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) √ isSet is a Function + Testing isSimilar + + √ isSimilar is a Function + Testing isSorted √ isSorted is a Function @@ -1090,8 +1096,8 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing mostPerformant - ✔ mostPerformant is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ mostPerformant is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing negate @@ -1100,11 +1106,11 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing none - ✔ none is a Function - ✔ Returns true for arrays with no truthy values - ✔ Returns false for arrays with at least one truthy value - ✔ Returns true with a predicate function - ✔ Returns false with predicate function + √ none is a Function + √ Returns true for arrays with no truthy values + √ Returns false for arrays with at least one truthy value + √ Returns true with a predicate function + √ Returns false with predicate function Testing nthArg @@ -1136,8 +1142,8 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing off - ✔ off is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ off is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing omit @@ -1151,18 +1157,18 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing on - ✔ on is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ on is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing once - ✔ onUserInputChange is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ once is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing onUserInputChange - ✔ once is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ onUserInputChange is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing orderBy @@ -1304,10 +1310,10 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing randomHexColorCode - ✔ randomHexColorCode is a Function - ✔ should be equal - ✔ The color code starts with "#" - ✔ The color code contains only valid hex-digits + √ randomHexColorCode is a Function + √ should be equal + √ The color code starts with "#" + √ The color code contains only valid hex-digits Testing randomIntArrayInRange @@ -1440,8 +1446,8 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing setStyle - ✔ setStyle is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ setStyle is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing shallowClone @@ -1451,8 +1457,8 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing show - ✔ show is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ show is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing shuffle @@ -1593,17 +1599,18 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing throttle - ✔ throttle is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ throttle is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing times - ✔ timeTaken is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ times is a Function + √ Runs a function the specified amount of times Testing timeTaken √ timeTaken is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing toCamelCase @@ -1633,6 +1640,7 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing toggleClass √ toggleClass is a Function + √ Tested by @chalarangelo on 16/02/2018 Testing toKebabCase @@ -1664,8 +1672,18 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing toSafeInteger - ✔ toggleClass is a Function - ✔ Tested by @chalarangelo on 16/02/2018 + √ toSafeInteger is a Function + √ Number(toSafeInteger(3.2)) is a number + √ Converts a value to a safe integer + √ toSafeInteger('4.2') returns 4 + √ toSafeInteger(4.6) returns 5 + √ toSafeInteger([]) returns 0 + √ isNaN(toSafeInteger([1.5, 3124])) is true + √ isNaN(toSafeInteger('string')) is true + √ isNaN(toSafeInteger({})) is true + √ isNaN(toSafeInteger()) is true + √ toSafeInteger(Infinity) returns 9007199254740991 + √ toSafeInteger(3.2) takes less than 2s to run Testing toSnakeCase @@ -1888,17 +1906,17 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC) Testing zipWith - ✔ zipWith is a Function - ✔ Sends a GET request - ✔ Runs the function provided - ✔ Sends a POST request - ✔ Runs promises in series - ✔ Works as expecting, passing arguments properly - ✔ Works with multiple promises + √ zipWith is a Function + √ Runs the function provided + √ Runs promises in series + √ Sends a GET request + √ Sends a POST request + √ Works as expecting, passing arguments properly + √ Works with multiple promises - total: 970 - passing: 970 - duration: 2.5s + total: 974 + passing: 974 + duration: 2.6s