Last active
September 13, 2017 07:54
-
-
Save alextanhongpin/dc36190af722af9e70701cfef7108bf8 to your computer and use it in GitHub Desktop.
precise time
This file contains 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
// return precise time in milliseconds, good for benchmarking | |
const PreciseTime = () => { | |
const hrTime = process.hrtime() | |
// time is an array [seconds, nanoseconds] | |
return hrTime[0] * 1000 + hrTime[1] / 1000000000 | |
} | |
module.exports = PreciseTime |
This file contains 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
Joi.string().allow('red', 'blue', 'yellow') | |
['red', 'blue', 'green', 'yellow'].every(...validate) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment