HEX
Server: Apache
System: Linux srv10.cpanelhost.cl 3.10.0-962.3.2.lve1.5.88.el7.x86_64 #1 SMP Fri Sep 26 14:06:42 UTC 2025 x86_64
User: cco26461 (4967)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: //proc/self/root/opt/alt/alt-nodejs9/root/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