@@ -74,59 +74,119 @@ const {
74
74
75
75
let internalDeepEqual ;
76
76
77
+ /**
78
+ * @deprecated since v4.0.0
79
+ * @param {any } arg
80
+ * @returns {arg is boolean }
81
+ */
77
82
function isBoolean ( arg ) {
78
83
return typeof arg === 'boolean' ;
79
84
}
80
85
86
+ /**
87
+ * @deprecated since v4.0.0
88
+ * @param {any } arg
89
+ * @returns {arg is null }
90
+ */
81
91
function isNull ( arg ) {
82
92
return arg === null ;
83
93
}
84
94
95
+ /**
96
+ * @deprecated since v4.0.0
97
+ * @param {any } arg
98
+ * @returns {arg is (null | undefined) }
99
+ */
85
100
function isNullOrUndefined ( arg ) {
86
101
return arg === null || arg === undefined ;
87
102
}
88
103
104
+ /**
105
+ * @deprecated since v4.0.0
106
+ * @param {any } arg
107
+ * @returns {arg is number }
108
+ */
89
109
function isNumber ( arg ) {
90
110
return typeof arg === 'number' ;
91
111
}
92
112
113
+ /**
114
+ * @param {any } arg
115
+ * @returns {arg is string }
116
+ */
93
117
function isString ( arg ) {
94
118
return typeof arg === 'string' ;
95
119
}
96
120
121
+ /**
122
+ * @deprecated since v4.0.0
123
+ * @param {any } arg
124
+ * @returns {arg is symbol }
125
+ */
97
126
function isSymbol ( arg ) {
98
127
return typeof arg === 'symbol' ;
99
128
}
100
129
130
+ /**
131
+ * @deprecated since v4.0.0
132
+ * @param {any } arg
133
+ * @returns {arg is undefined }
134
+ */
101
135
function isUndefined ( arg ) {
102
136
return arg === undefined ;
103
137
}
104
138
139
+ /**
140
+ * @deprecated since v4.0.0
141
+ * @param {any } arg
142
+ * @returns {a is NonNullable<object> }
143
+ */
105
144
function isObject ( arg ) {
106
145
return arg !== null && typeof arg === 'object' ;
107
146
}
108
147
148
+ /**
149
+ * @deprecated since v4.0.0
150
+ * @param {any } e
151
+ * @returns {arg is Error }
152
+ */
109
153
function isError ( e ) {
110
154
return ObjectPrototypeToString ( e ) === '[object Error]' || e instanceof Error ;
111
155
}
112
156
157
+ /**
158
+ * @deprecated since v4.0.0
159
+ * @param {any } arg
160
+ * @returns {arg is Function }
161
+ */
113
162
function isFunction ( arg ) {
114
163
return typeof arg === 'function' ;
115
164
}
116
165
166
+ /**
167
+ * @deprecated since v4.0.0
168
+ * @param {any } arg
169
+ * @returns {arg is (boolean | null | number | string | symbol | undefined) }
170
+ */
117
171
function isPrimitive ( arg ) {
118
172
return arg === null ||
119
173
( typeof arg !== 'object' && typeof arg !== 'function' ) ;
120
174
}
121
175
176
+ /**
177
+ * @param {number } n
178
+ * @returns {string }
179
+ */
122
180
function pad ( n ) {
123
181
return StringPrototypePadStart ( n . toString ( ) , 2 , '0' ) ;
124
182
}
125
183
126
184
const months = [ 'Jan' , 'Feb' , 'Mar' , 'Apr' , 'May' , 'Jun' , 'Jul' , 'Aug' , 'Sep' ,
127
185
'Oct' , 'Nov' , 'Dec' ] ;
128
186
129
- // 26 Feb 16:19:34
187
+ /**
188
+ * @returns {string } 26 Feb 16:19:34
189
+ */
130
190
function timestamp ( ) {
131
191
const d = new Date ( ) ;
132
192
const t = ArrayPrototypeJoin ( [
@@ -138,7 +198,11 @@ function timestamp() {
138
198
}
139
199
140
200
let console ;
141
- // Log is just a thin wrapper to console.log that prepends a timestamp
201
+ /**
202
+ * Log is just a thin wrapper to console.log that prepends a timestamp
203
+ * @deprecated since v6.0.0
204
+ * @type {(...args: any[]) => void }
205
+ */
142
206
function log ( ...args ) {
143
207
if ( ! console ) {
144
208
console = require ( 'internal/console/global' ) ;
@@ -155,9 +219,9 @@ function log(...args) {
155
219
* functions as prototype setup using normal JavaScript does not work as
156
220
* expected during bootstrapping (see mirror.js in r114903).
157
221
*
158
- * @param {function } ctor Constructor function which needs to inherit the
222
+ * @param {Function } ctor Constructor function which needs to inherit the
159
223
* prototype.
160
- * @param {function } superCtor Constructor function to inherit prototype from.
224
+ * @param {Function } superCtor Constructor function to inherit prototype from.
161
225
* @throws {TypeError } Will error if either constructor is null, or if
162
226
* the super constructor lacks a prototype.
163
227
*/
@@ -181,6 +245,14 @@ function inherits(ctor, superCtor) {
181
245
ObjectSetPrototypeOf ( ctor . prototype , superCtor . prototype ) ;
182
246
}
183
247
248
+ /**
249
+ * @deprecated since v6.0.0
250
+ * @template T
251
+ * @template S
252
+ * @param {T } target
253
+ * @param {S } source
254
+ * @returns {S extends null ? T : (T & S) }
255
+ */
184
256
function _extend ( target , source ) {
185
257
// Don't do anything if source isn't an object
186
258
if ( source === null || typeof source !== 'object' ) return target ;
@@ -204,6 +276,14 @@ const callbackifyOnRejected = hideStackFrames((reason, cb) => {
204
276
return cb ( reason ) ;
205
277
} ) ;
206
278
279
+ /**
280
+ * @template {(...args: any[]) => Promise<any>} T
281
+ * @param {T } original
282
+ * @returns {T extends (...args: infer TArgs) => Promise<infer TReturn> ?
283
+ * ((...params: [...TArgs, ((err: Error, ret: TReturn) => any)]) => void) :
284
+ * never
285
+ * }
286
+ */
207
287
function callbackify ( original ) {
208
288
if ( typeof original !== 'function' ) {
209
289
throw new ERR_INVALID_ARG_TYPE ( 'original' , 'Function' , original ) ;
@@ -238,6 +318,10 @@ function callbackify(original) {
238
318
return callbackified ;
239
319
}
240
320
321
+ /**
322
+ * @param {number } err
323
+ * @returns {string }
324
+ */
241
325
function getSystemErrorName ( err ) {
242
326
validateNumber ( err , 'err' ) ;
243
327
if ( err >= 0 || ! NumberIsSafeInteger ( err ) ) {
0 commit comments