This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/normalize-package-data/lib/make_warning.js
2019-08-11 20:48:02 +02:00

23 lines
710 B
JavaScript

var util = require("util")
var messages = require("./warning_messages.json")
module.exports = function() {
var args = Array.prototype.slice.call(arguments, 0)
var warningName = args.shift()
if (warningName == "typo") {
return makeTypoWarning.apply(null,args)
}
else {
var msgTemplate = messages[warningName] ? messages[warningName] : warningName + ": '%s'"
args.unshift(msgTemplate)
return util.format.apply(null, args)
}
}
function makeTypoWarning (providedName, probableName, field) {
if (field) {
providedName = field + "['" + providedName + "']"
probableName = field + "['" + probableName + "']"
}
return util.format(messages.typo, providedName, probableName)
}