mirror of https://github.com/lukechilds/node.git
Browse Source
`printDeprecationMessage` is used to deprecate modules and execution branches. PR-URL: https://github.com/nodejs/io.js/pull/1822 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>v2.3.1-release
Vladimir Kurchatkin
10 years ago
5 changed files with 26 additions and 26 deletions
@ -0,0 +1,18 @@ |
|||||
|
'use strict'; |
||||
|
|
||||
|
exports.printDeprecationMessage = function(msg, warned) { |
||||
|
if (process.noDeprecation) |
||||
|
return true; |
||||
|
|
||||
|
if (warned) |
||||
|
return warned; |
||||
|
|
||||
|
if (process.throwDeprecation) |
||||
|
throw new Error(msg); |
||||
|
else if (process.traceDeprecation) |
||||
|
console.trace(msg); |
||||
|
else |
||||
|
console.error(msg); |
||||
|
|
||||
|
return true; |
||||
|
}; |
@ -1,13 +1,10 @@ |
|||||
'use strict'; |
'use strict'; |
||||
|
|
||||
const util = require('util'); |
const util = require('internal/util'); |
||||
|
|
||||
// the sys module was renamed to 'util'.
|
// the sys module was renamed to 'util'.
|
||||
// this shim remains to keep old programs working.
|
// this shim remains to keep old programs working.
|
||||
// sys is deprecated and shouldn't be used
|
// sys is deprecated and shouldn't be used
|
||||
|
|
||||
const setExports = util.deprecate(function() { |
module.exports = require('util'); |
||||
module.exports = util; |
util.printDeprecationMessage('sys is deprecated. Use util instead.'); |
||||
}, 'sys is deprecated. Use util instead.'); |
|
||||
|
|
||||
setExports(); |
|
||||
|
Loading…
Reference in new issue