This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Linear search is a very simple search algorithm. | |
* In this type of search, a sequential search is made over all items one by one. | |
* Every item is checked and if a match is found then that particular item is returned, | |
* otherwise the search continues till the end of the data collection. | |
* @param {*} arr : An array in which you want to search the value | |
* @param {*} valueToSearch : value to be search in array | |
*/ | |
function linearSearch(arr , valueToSearch){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let arrayToBeSort = [12,45,75,35,55,54,2,21] | |
// ## Bubble Sort | |
/** | |
* | |
* Bubble sort is a simple sorting algorithm. | |
* This sorting algorithm is comparison-based algorithm | |
* in which each pair of adjacent elements is compared | |
* and the elements are swapped if they are not in order. | |
* This algorithm is not suitable for large data sets as |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var chokidar = require('chokidar'); | |
var fs = require('fs') | |
var path = require('path') | |
var testFileExtension = 'spec.js' | |
var ignorefile = [/[\/\\]\./, 'package.json', 'node_modules', 'watcher.js']; | |
/** | |
* @getTemplate A function to get Tempate content for new test file | |
* @filename It just take on argument that is file | |
* @returns : string | |
**/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs') | |
var path = require('path') | |
/** | |
* function To generate the descption for test | |
* @param { String } filename name of api for which we need to generate test cases | |
* @returns { String } template for test cases | |
**/ | |
function getTestTemplate(endpoint, httpMethod = 'GET') { | |
endpoint = JSON.stringify(endpoint) | |
return `var chai = require('chai'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sorting an array order by frequency of occurence in javascript | |
* @param {array} array An array to sort | |
* @returns {array} array of item order by frequency | |
**/ | |
function sortByFrequency(array) { | |
var frequency = {}; | |
var sortAble = []; | |
var newArr = []; |