"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/npm/lib/utils/warn-deprecated.js" (7 Feb 2017, 556 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 module.exports = warnDeprecated
    2 
    3 var log = require('npmlog')
    4 
    5 var deprecations = {}
    6 
    7 function warnDeprecated (type) {
    8   return function warn (messages, instance) {
    9     if (!instance) {
   10       if (!deprecations[type]) {
   11         deprecations[type] = {}
   12         messages.forEach(function (m) { log.warn(type, m) })
   13       }
   14     } else {
   15       if (!deprecations[type]) deprecations[type] = {}
   16 
   17       if (!deprecations[type][instance]) {
   18         deprecations[type][instance] = true
   19         messages.forEach(function (m) { log.warn(type, m) })
   20       }
   21     }
   22   }
   23 }