HEX
Server: LiteSpeed
System: Linux server53.web-hosting.com 4.18.0-513.24.1.lve.1.el8.x86_64 #1 SMP Thu May 9 15:10:09 UTC 2024 x86_64
User: nahevttf (6494)
PHP: 8.0.30
Disabled: NONE
Upload Files
File: //opt/alt/alt-nodejs9/root/usr/lib/node_modules/npm/lib/utils/did-you-mean.js
var meant = require('meant')
var output = require('./output.js')

function didYouMean (scmd, commands) {
  var bestSimilarity = meant(scmd, commands).map(function (str) {
    return '    ' + str
  })

  if (bestSimilarity.length === 0) return
  if (bestSimilarity.length === 1) {
    output('\nDid you mean this?\n' + bestSimilarity[0])
  } else {
    output(
      ['\nDid you mean one of these?']
        .concat(bestSimilarity.slice(0, 3)).join('\n')
    )
  }
}

module.exports = didYouMean