mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
24 lines
710 B
JavaScript
24 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)
|
|
}
|