Urara-Blog/node_modules/.pnpm-store/v3/files/92/60f0a84ac7ce82665ea792d3df32342d9813c5834efcadb6fd62adc5cb463740973e2de03b179453629cf027973bd3603d05d72856e6c2f5d0986185cc0d17
2022-08-14 01:14:53 +08:00

23 lines
710 B
Text

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)
}