AnonSec Team
Server IP : 185.61.154.36  /  Your IP : 216.73.216.44
Web Server : Apache
System : Linux host67.registrar-servers.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User : gettoplisting ( 12043)
PHP Version : 7.2.34
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/../usr/sbin/../lib/node_modules/npm/node_modules/ip-regex/../lodash.without/../meant/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/../usr/sbin/../lib/node_modules/npm/node_modules/ip-regex/../lodash.without/../meant/index.js
function levenshteinD (s1, s2) {
  var d = []
  var i = 0

  for (i = 0; i <= s1.length; i++) d[i] = [i]
  for (i = 0; i <= s2.length; i++) d[0][i] = i

  s2.split('').forEach(function (c2, j) {
    s1.split('').forEach(function (c1, i) {
      if (c1 === c2) {
        d[i + 1][j + 1] = d[i][j]
        return
      }
      d[i + 1][j + 1] = Math.min(
        d[i][j + 1] + 1,
        d[i + 1][j] + 1,
        d[i][j] + 1
      )
    })
  })

  return d[s1.length][s2.length]
}

function meant (scmd, commands) {
  var d = []
  var bestSimilarity = []

  commands.forEach(function (cmd, i) {
    var item = {}
    item[levenshteinD(scmd, cmd)] = i
    d.push(item)
  })

  d.sort(function (a, b) {
    return Number(Object.keys(a)[0]) - Number(Object.keys(b)[0])
  })

  d.forEach(function (item) {
    var key = Number(Object.keys(item)[0])
    if (scmd.length / 2 >= key) {
      bestSimilarity.push(commands[item[key]])
    }
  })

  return bestSimilarity
}

module.exports = meant

AnonSec - 2021