File tree Expand file tree Collapse file tree 2 files changed +25
-23
lines changed
Expand file tree Collapse file tree 2 files changed +25
-23
lines changed Original file line number Diff line number Diff line change @@ -16,3 +16,27 @@ exports.printDeprecationMessage = function(msg, warned) {
1616
1717 return true ;
1818} ;
19+
20+ // Mark that a method should not be used.
21+ // Returns a modified function which warns once by default.
22+ // If --no-deprecation is set, then it is a no-op.
23+ exports . deprecate = function ( fn , msg ) {
24+ // Allow for deprecating things in the process of starting up.
25+ if ( global . process === undefined ) {
26+ return function ( ) {
27+ return exports . deprecate ( fn , msg ) . apply ( this , arguments ) ;
28+ } ;
29+ }
30+
31+ if ( process . noDeprecation === true ) {
32+ return fn ;
33+ }
34+
35+ var warned = false ;
36+ function deprecated ( ) {
37+ warned = exports . printDeprecationMessage ( msg , warned ) ;
38+ return fn . apply ( this , arguments ) ;
39+ }
40+
41+ return deprecated ;
42+ } ;
Original file line number Diff line number Diff line change @@ -48,29 +48,7 @@ exports.format = function(f) {
4848} ;
4949
5050
51- // Mark that a method should not be used.
52- // Returns a modified function which warns once by default.
53- // If --no-deprecation is set, then it is a no-op.
54- exports . deprecate = function ( fn , msg ) {
55- // Allow for deprecating things in the process of starting up.
56- if ( global . process === undefined ) {
57- return function ( ) {
58- return exports . deprecate ( fn , msg ) . apply ( this , arguments ) ;
59- } ;
60- }
61-
62- if ( process . noDeprecation === true ) {
63- return fn ;
64- }
65-
66- var warned = false ;
67- function deprecated ( ) {
68- warned = internalUtil . printDeprecationMessage ( msg , warned ) ;
69- return fn . apply ( this , arguments ) ;
70- }
71-
72- return deprecated ;
73- } ;
51+ exports . deprecate = internalUtil . deprecate ;
7452
7553
7654var debugs = { } ;
You can’t perform that action at this time.
0 commit comments