add snippet to archive

This commit is contained in:
Rohit Tanwar
2018-02-26 15:01:26 +05:30
parent 9af611381a
commit b78004b13e
5 changed files with 10 additions and 18 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "30-seconds-of-code", "name": "30-seconds-of-code",
"version": "0.0.1", "version": "0.0.2",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -144,7 +144,6 @@ join:array
JSONToFile:node,json JSONToFile:node,json
last:array last:array
lcm:math,recursion lcm:math,recursion
levenshteinDistance:string,utility
longestItem:array,string,utility longestItem:array,string,utility
lowercaseKeys:object lowercaseKeys:object
luhnCheck:math,utility luhnCheck:math,utility

View File

@ -3,8 +3,8 @@ if(string1.length === 0) return string2.length;
if(string2.length === 0) return string1.length; if(string2.length === 0) return string1.length;
let matrix = Array(string2.length+ 1).fill(0).map((x,i) => [i]); let matrix = Array(string2.length+ 1).fill(0).map((x,i) => [i]);
matrix[0] = Array(string1.length + 1).fill(0).map((x,i) => i); matrix[0] = Array(string1.length + 1).fill(0).map((x,i) => i);
for(i = 1;i <= string2.length;i++){ for(let i = 1;i <= string2.length;i++){
for(j = 1;j<=string1.length; j++){ for(let j = 1;j<=string1.length; j++){
if(string2[i-1] === string1[j-1]){ if(string2[i-1] === string1[j-1]){
matrix[i][j] = matrix[i-1][j-1]; matrix[i][j] = matrix[i-1][j-1];
} }

View File

@ -1,4 +1,4 @@
Test log for: Sun Feb 18 2018 20:24:43 GMT+0000 (UTC) Test log for: Mon Feb 26 2018 15:00:57 GMT+0530 (India Standard Time)
> 30-seconds-of-code@0.0.2 test R:\github\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
@ -538,12 +538,6 @@ Test log for: Sun Feb 18 2018 20:24:43 GMT+0000 (UTC)
√ Returns own methods √ Returns own methods
√ Returns own and inherited methods √ Returns own and inherited methods
Testing fuzzySearch
√ fuzzySearch is a Function
√ Provided examples work
√ Provided examples work
Testing gcd Testing gcd
√ gcd is a Function √ gcd is a Function
@ -1529,8 +1523,8 @@ Test log for: Sun Feb 18 2018 20:24:43 GMT+0000 (UTC)
Testing stableSort Testing stableSort
stableSort is a Function stableSort is a Function
Array is properly sorted Array is properly sorted
Testing standardDeviation Testing standardDeviation
@ -1914,15 +1908,14 @@ Test log for: Sun Feb 18 2018 20:24:43 GMT+0000 (UTC)
√ zipWith is a Function √ zipWith is a Function
√ Runs the function provided √ Runs the function provided
√ Runs promises in series √ Runs promises in series
√ Works as expecting, passing arguments properly
√ Sends a GET request √ Sends a GET request
√ Works as expecting, passing arguments properly
√ Sends a POST request √ Sends a POST request
√ Works with multiple promises √ Works with multiple promises
total: 973
total: 974 passing: 973
passing: 974 duration: 3s
duration: 2.9s