mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
lib: refactor to use validateFunction
add validateFunction and refactor to use validateFunction PR-URL: https://github.com/nodejs/node/pull/37045 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
8c3cdce418
commit
064a7070c7
15 changed files with 79 additions and 79 deletions
|
@ -68,7 +68,10 @@ const {
|
|||
kHandle,
|
||||
} = require('internal/histogram');
|
||||
|
||||
const { validateCallback } = require('internal/validators');
|
||||
const {
|
||||
validateCallback,
|
||||
validateFunction,
|
||||
} = require('internal/validators');
|
||||
|
||||
const { setImmediate } = require('timers');
|
||||
const kCallback = Symbol('callback');
|
||||
|
@ -463,9 +466,7 @@ class Performance {
|
|||
}
|
||||
|
||||
timerify(fn) {
|
||||
if (typeof fn !== 'function') {
|
||||
throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn);
|
||||
}
|
||||
validateFunction(fn, 'fn');
|
||||
if (fn[kTimerified])
|
||||
return fn[kTimerified];
|
||||
const ret = timerify(fn, fn.length);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue