util: move deprecate() to internal module
authorBrendan Ashworth <brendan.ashworth@me.com>
Tue, 16 Jun 2015 04:51:41 +0000 (21:51 -0700)
committerBrendan Ashworth <brendan.ashworth@me.com>
Tue, 16 Jun 2015 23:06:45 +0000 (16:06 -0700)
PR-URL: https://github.com/nodejs/io.js/pull/1988
Reviewed-By: Roman Reiss <me@silverwind.io>
lib/internal/util.js
lib/util.js

index 7657633..8019260 100644 (file)
@@ -16,3 +16,27 @@ exports.printDeprecationMessage = function(msg, warned) {
 
   return true;
 };
+
+// Mark that a method should not be used.
+// Returns a modified function which warns once by default.
+// If --no-deprecation is set, then it is a no-op.
+exports.deprecate = function(fn, msg) {
+  // Allow for deprecating things in the process of starting up.
+  if (global.process === undefined) {
+    return function() {
+      return exports.deprecate(fn, msg).apply(this, arguments);
+    };
+  }
+
+  if (process.noDeprecation === true) {
+    return fn;
+  }
+
+  var warned = false;
+  function deprecated() {
+    warned = exports.printDeprecationMessage(msg, warned);
+    return fn.apply(this, arguments);
+  }
+
+  return deprecated;
+};
index 177cf45..afddf43 100644 (file)
@@ -48,29 +48,7 @@ exports.format = function(f) {
 };
 
 
-// Mark that a method should not be used.
-// Returns a modified function which warns once by default.
-// If --no-deprecation is set, then it is a no-op.
-exports.deprecate = function(fn, msg) {
-  // Allow for deprecating things in the process of starting up.
-  if (global.process === undefined) {
-    return function() {
-      return exports.deprecate(fn, msg).apply(this, arguments);
-    };
-  }
-
-  if (process.noDeprecation === true) {
-    return fn;
-  }
-
-  var warned = false;
-  function deprecated() {
-    warned = internalUtil.printDeprecationMessage(msg, warned);
-    return fn.apply(this, arguments);
-  }
-
-  return deprecated;
-};
+exports.deprecate = internalUtil.deprecate;
 
 
 var debugs = {};