Newer
Older
CVSS_3.0_GUI / dist / CVSS_3.0_Calc-1.0.0-linux-x64 / node_modules / nwjs-builder-phoenix / node_modules / yargs / node_modules / read-pkg-up / node_modules / read-pkg / node_modules / normalize-package-data / lib / make_warning.js
root on 7 May 2019 710 bytes Initial commit
  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. }
Buy Me A Coffee