Skip to content

Instantly share code, notes, and snippets.

@alextanhongpin
Last active September 13, 2017 07:54
Show Gist options
  • Save alextanhongpin/dc36190af722af9e70701cfef7108bf8 to your computer and use it in GitHub Desktop.
Save alextanhongpin/dc36190af722af9e70701cfef7108bf8 to your computer and use it in GitHub Desktop.
precise time
// 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
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