Skip to content

Commit

Permalink
compileTime added
Browse files Browse the repository at this point in the history
  • Loading branch information
MHDYousuf committed Jul 22, 2023
1 parent e2a97e1 commit f566731
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
18 changes: 18 additions & 0 deletions compileTime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// function to calculate time taken to execute the function

/*
* @params func() code
*/

function compileTime(func = () => {}) {
if(!Object.prototype.toString.call(func) == '[object Function]'){
return new TypeError('compileTime() : Argument is not a function');
}
console.time("Function");
func();
console.timeEnd("Function");
}

compileTime(result())

export default compileTime
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import sumArray from './sumArray.js'
import isAnagram from './isAnagram.js'
import twoSum from './twoSum.js'
import compileTime from './compileTime.js'

export { sumArray };
export { sumArray,isAnagram,twoSum,compileTime };
Empty file removed index.test.js
Empty file.

0 comments on commit f566731

Please sign in to comment.