"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/normalize-package-data/lib/make_warning.js" (8 Mar 2017, 709 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 var util = require("util")
    2 var messages = require("./warning_messages.json")
    3 
    4 module.exports = function() {
    5   var args = Array.prototype.slice.call(arguments, 0)
    6   var warningName = args.shift()
    7   if (warningName == "typo") {
    8     return makeTypoWarning.apply(null,args)
    9   }
   10   else {
   11     var msgTemplate = messages[warningName] ? messages[warningName] : warningName + ": '%s'"
   12     args.unshift(msgTemplate)
   13     return util.format.apply(null, args)
   14   }
   15 }
   16 
   17 function makeTypoWarning (providedName, probableName, field) {
   18   if (field) {
   19     providedName = field + "['" + providedName + "']"
   20     probableName = field + "['" + probableName + "']"
   21   }
   22   return util.format(messages.typo, providedName, probableName)
   23 }