This commit is contained in:
Rohit Tanwar
2018-02-26 15:06:47 +05:30
parent a81b335497
commit a47f64c89a
5 changed files with 128 additions and 93 deletions

View File

@ -82,7 +82,6 @@ forOwnRight:object
fromCamelCase:string fromCamelCase:string
functionName:function,utility functionName:function,utility
functions:object,function functions:object,function
fuzzySearch:string,utility
gcd:math,recursion gcd:math,recursion
geometricProgression:math geometricProgression:math
get:object get:object

View File

@ -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;

View File

@ -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();
});

View File

@ -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 > tape test/**/*.test.js | tap-spec
Testing all Testing all
all is a Function all is a Function
Returns true for arrays with no falsey values Returns true for arrays with no falsey values
Returns false for arrays with 0 Returns false for arrays with 0
Returns false for arrays with NaN Returns false for arrays with NaN
Returns false for arrays with undefined Returns false for arrays with undefined
Returns false for arrays with null Returns false for arrays with null
Returns false for arrays with empty strings Returns false for arrays with empty strings
Returns true with predicate function Returns true with predicate function
Returns false with a predicate function Returns false with a predicate function
Testing anagrams Testing anagrams
@ -25,12 +25,12 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing any Testing any
any is a Function any is a Function
Returns true for arrays with at least one truthy value 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 false for arrays with no truthy values Returns false for arrays with no truthy values
Returns true with predicate function Returns true with predicate function
Returns false with a predicate function Returns false with a predicate function
Testing approximatelyEqual Testing approximatelyEqual
@ -42,8 +42,8 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing arrayToHtmlList Testing arrayToHtmlList
arrayToHtmlList is a Function arrayToHtmlList is a Function
Tested by @chalarangelo on 16/02/2018 Tested by @chalarangelo on 16/02/2018
Testing ary Testing ary
@ -64,18 +64,18 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing average Testing average
average is a Function average is a Function
average(true) returns 0 average(true) returns 0
average(false) returns 1 average(false) returns 1
average(9, 1) returns 5 average(9, 1) returns 5
average(153, 44, 55, 64, 71, 1122, 322774, 2232, 23423, 234, 3631) returns 32163.909090909092 average(153, 44, 55, 64, 71, 1122, 322774, 2232, 23423, 234, 3631) returns 32163.909090909092
average(1, 2, 3) returns 2 average(1, 2, 3) returns 2
average(null) returns 0 average(null) returns 0
average(1, 2, 3) returns NaN average(1, 2, 3) returns NaN
average(String) returns NaN average(String) returns NaN
average({ a: 123}) returns NaN average({ a: 123}) returns NaN
average([undefined, 0, string]) 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([1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 1122, 32124, 23232]) takes less than 2s to run
Testing averageBy Testing averageBy
@ -173,8 +173,8 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing chainAsync Testing chainAsync
chainAsync is a Function chainAsync is a Function
Calls all functions in an array Calls all functions in an array
Testing chunk Testing chunk
@ -273,18 +273,18 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing createElement Testing createElement
createElement is a Function createElement is a Function
Tested by @chalarangelo on 16/02/2018 Tested by @chalarangelo on 16/02/2018
Testing createEventHub Testing createEventHub
createEventHub is a Function createEventHub is a Function
Tested by @chalarangelo on 16/02/2018 Tested by @chalarangelo on 16/02/2018
Testing currentURL Testing currentURL
currentURL is a Function currentURL is a Function
Tested by @chalarangelo on 16/02/2018 Tested by @chalarangelo on 16/02/2018
Testing curry Testing curry
@ -315,13 +315,13 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing defaults Testing defaults
defaults is a Function defaults is a Function
Assigns default values for undefined properties Assigns default values for undefined properties
Testing defer Testing defer
defer is a Function defer is a Function
Tested by @chalarangelo on 16/02/2018 Tested by @chalarangelo on 16/02/2018
Testing degreesToRads Testing degreesToRads
@ -541,6 +541,8 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing fuzzySearch Testing fuzzySearch
√ fuzzySearch is a Function √ fuzzySearch is a Function
√ Provided examples work
√ Provided examples work
Testing gcd Testing gcd
@ -575,13 +577,13 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing getScrollPosition Testing getScrollPosition
getScrollPosition is a Function getScrollPosition is a Function
Tested by @chalarangelo on 16/02/2018 Tested by @chalarangelo on 16/02/2018
Testing getStyle Testing getStyle
getStyle is a Function getStyle is a Function
Tested by @chalarangelo on 16/02/2018 Tested by @chalarangelo on 16/02/2018
Testing getType Testing getType
@ -610,13 +612,13 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing hasFlags Testing hasFlags
hasFlags is a Function hasFlags is a Function
Tested by @chalarangelo on 16/02/2018 Tested by @chalarangelo on 16/02/2018
Testing hashBrowser Testing hashBrowser
hashBrowser is a Function hashBrowser is a Function
Tested by @chalarangelo on 16/02/2018 Tested by @chalarangelo on 16/02/2018
Testing hashNode Testing hashNode
@ -643,8 +645,8 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing hide Testing hide
hide is a Function hide is a Function
Tested by @chalarangelo on 16/02/2018 Tested by @chalarangelo on 16/02/2018
Testing howManyTimes Testing howManyTimes
@ -902,6 +904,10 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
√ isSet is a Function √ isSet is a Function
Testing isSimilar
√ isSimilar is a Function
Testing isSorted Testing isSorted
√ isSorted is a Function √ isSorted is a Function
@ -1090,8 +1096,8 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing mostPerformant Testing mostPerformant
mostPerformant is a Function mostPerformant is a Function
Tested by @chalarangelo on 16/02/2018 Tested by @chalarangelo on 16/02/2018
Testing negate Testing negate
@ -1100,11 +1106,11 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing none Testing none
none is a Function none is a Function
Returns true for arrays with no truthy values Returns true for arrays with no truthy values
Returns false for arrays with at least one truthy value Returns false for arrays with at least one truthy value
Returns true with a predicate function Returns true with a predicate function
Returns false with predicate function Returns false with predicate function
Testing nthArg Testing nthArg
@ -1136,8 +1142,8 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing off Testing off
off is a Function off is a Function
Tested by @chalarangelo on 16/02/2018 Tested by @chalarangelo on 16/02/2018
Testing omit Testing omit
@ -1151,18 +1157,18 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing on Testing on
on is a Function on is a Function
Tested by @chalarangelo on 16/02/2018 Tested by @chalarangelo on 16/02/2018
Testing once Testing once
onUserInputChange is a Function once is a Function
Tested by @chalarangelo on 16/02/2018 Tested by @chalarangelo on 16/02/2018
Testing onUserInputChange Testing onUserInputChange
once is a Function onUserInputChange is a Function
Tested by @chalarangelo on 16/02/2018 Tested by @chalarangelo on 16/02/2018
Testing orderBy Testing orderBy
@ -1304,10 +1310,10 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing randomHexColorCode Testing randomHexColorCode
randomHexColorCode is a Function randomHexColorCode is a Function
should be equal should be equal
The color code starts with "#" The color code starts with "#"
The color code contains only valid hex-digits The color code contains only valid hex-digits
Testing randomIntArrayInRange Testing randomIntArrayInRange
@ -1440,8 +1446,8 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing setStyle Testing setStyle
setStyle is a Function setStyle is a Function
Tested by @chalarangelo on 16/02/2018 Tested by @chalarangelo on 16/02/2018
Testing shallowClone Testing shallowClone
@ -1451,8 +1457,8 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing show Testing show
show is a Function show is a Function
Tested by @chalarangelo on 16/02/2018 Tested by @chalarangelo on 16/02/2018
Testing shuffle Testing shuffle
@ -1593,17 +1599,18 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing throttle Testing throttle
throttle is a Function throttle is a Function
Tested by @chalarangelo on 16/02/2018 Tested by @chalarangelo on 16/02/2018
Testing times Testing times
timeTaken is a Function times is a Function
✔ Tested by @chalarangelo on 16/02/2018 √ Runs a function the specified amount of times
Testing timeTaken Testing timeTaken
√ timeTaken is a Function √ timeTaken is a Function
√ Tested by @chalarangelo on 16/02/2018
Testing toCamelCase Testing toCamelCase
@ -1633,6 +1640,7 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing toggleClass Testing toggleClass
√ toggleClass is a Function √ toggleClass is a Function
√ Tested by @chalarangelo on 16/02/2018
Testing toKebabCase Testing toKebabCase
@ -1664,8 +1672,18 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing toSafeInteger Testing toSafeInteger
toggleClass is a Function toSafeInteger is a Function
✔ Tested by @chalarangelo on 16/02/2018 √ 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 Testing toSnakeCase
@ -1888,17 +1906,17 @@ Test log for: Fri Feb 16 2018 20:23:57 GMT+0000 (UTC)
Testing zipWith Testing zipWith
zipWith is a Function zipWith is a Function
✔ Sends a GET request √ Runs the function provided
Runs the function provided Runs promises in series
Sends a POST request Sends a GET request
✔ Runs promises in series √ Sends a POST request
Works as expecting, passing arguments properly Works as expecting, passing arguments properly
Works with multiple promises Works with multiple promises
total: 970 total: 974
passing: 970 passing: 974
duration: 2.5s duration: 2.6s