/home/lnzliplg/public_html/meant.zip
PKla�\�!Q��index.jsnu�[���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
PKma�\�C=%��.github/workflows/ci.ymlnu�[���name: Node.js CI

on: [push, pull_request]

jobs:
  build:
    strategy:
      matrix:
        node-version: [6.x, 8.x, 10.x, 12.x]
        os: [ubuntu-latest, windows-latest, macOS-latest]
    runs-on: ${{ matrix.os }}

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm install
    - run: npm test
PKma�\[=�w��	README.mdnu�[���# meant ![Build status](https://github.com/watilde/meant/workflows/Node.js%20CI/badge.svg)

Like the `Did you mean?` in git for npm

## API
### meant(item, list)
+ item {String} A key for finding an approximate value
+ list {Array} A list for comparing with the item

```js
const meant = require('meant')
const result = meant('foa', ['foo', 'bar', 'baz'])
// => [ 'foo' ]
```

## Installation

Download node at [nodejs.org](http://nodejs.org) and install it, if you haven't already.

```sh
npm install meant --save
```


## Tests

```sh
npm install
npm test
```
```

> meant@1.0.0 test /Users/watilde/Development/meant
> standard && tap test.js
TAP version 13
# Subtest: test.js
    # Subtest: test vs ['tast', 'tbst', 'tcst', 'foo']
        ok 1 - list has tast
        ok 2 - list has tbst
        ok 3 - list has tcst
        ok 4 - list doesn't have foo
        1..4
    ok 1 - test vs ['tast', 'tbst', 'tcst', 'foo'] # time=11.816ms
    1..1
    # time=44.006ms
ok 1 - test.js # time=249.154ms
1..1
# time=267.371ms

```

## Dependencies

None

## Dev Dependencies

- [standard](https://github.com/feross/standard): JavaScript Standard Style
- [standard-version](https://github.com/conventional-changelog/standard-version): replacement for `npm version` with automatic CHANGELOG generation
- [tap](https://github.com/tapjs/node-tap): A Test-Anything-Protocol library


## License

MIT

_Generated by [package-json-to-readme](https://github.com/zeke/package-json-to-readme)_
PKma�\�ĈF99CHANGELOG.mdnu�[���# Changelog

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.0.2](https://github.com/watilde/meant/compare/v1.0.1...v1.0.2) (2020-07-19)


### Bug Fixes

* **deps:** bump standard, standard-version and tap ([d31fb06](https://github.com/watilde/meant/commit/d31fb064495b031dd1152726da9bd2198daa36ff))
* **deps:** patch update in lock file ([4e699ee](https://github.com/watilde/meant/commit/4e699ee8751a69923dddf18c940acce630f4bf29))

<a name="1.0.1"></a>
## [1.0.1](https://github.com/watilde/meant/compare/v1.0.0...v1.0.1) (2017-08-23)


### Bug Fixes

* **package:** tweak the line ([915d949](https://github.com/watilde/meant/commit/915d949))



<a name="1.0.0"></a>
# 1.0.0 (2016-09-08)


### Bug Fixes

* **deps:** install devDeps and update tests ([d766d6f](https://github.com/watilde/meant/commit/d766d6f))
* **run-script:** add npm run release command ([9387904](https://github.com/watilde/meant/commit/9387904))
* **test:** add test.js ([65b6e99](https://github.com/watilde/meant/commit/65b6e99))
* **travis:** add .travis.yml ([24d918c](https://github.com/watilde/meant/commit/24d918c))


### Features

* **new-meant:** add index.js ([7289b99](https://github.com/watilde/meant/commit/7289b99))
PKma�\-�&��package.jsonnu�[���{
  "_from": "meant@1.0.2",
  "_id": "meant@1.0.2",
  "_inBundle": false,
  "_integrity": "sha512-KN+1uowN/NK+sT/Lzx7WSGIj2u+3xe5n2LbwObfjOhPZiA+cCfCm6idVl0RkEfjThkw5XJ96CyRcanq6GmKtUg==",
  "_location": "/meant",
  "_phantomChildren": {},
  "_requested": {
    "type": "version",
    "registry": true,
    "raw": "meant@1.0.2",
    "name": "meant",
    "escapedName": "meant",
    "rawSpec": "1.0.2",
    "saveSpec": null,
    "fetchSpec": "1.0.2"
  },
  "_requiredBy": [
    "#USER",
    "/"
  ],
  "_resolved": "https://registry.npmjs.org/meant/-/meant-1.0.2.tgz",
  "_shasum": "5d0c78310a3d8ae1408a16be0fe0bd42a969f560",
  "_spec": "meant@1.0.2",
  "_where": "/Users/ruyadorno/Documents/workspace/cli/latest",
  "author": {
    "name": "Daijiro Wachi"
  },
  "bugs": {
    "url": "https://github.com/watilde/meant/issues"
  },
  "bundleDependencies": false,
  "deprecated": false,
  "description": "Like the `Did you mean?` in git for npm",
  "devDependencies": {
    "standard": "^11.0.1",
    "standard-version": "^8.0.1",
    "tap": "^12.7.0"
  },
  "homepage": "https://github.com/watilde/meant#readme",
  "keywords": [
    "meant"
  ],
  "license": "MIT",
  "main": "index.js",
  "name": "meant",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/watilde/meant.git"
  },
  "scripts": {
    "release": "standard-version",
    "test": "standard && tap test.js"
  },
  "version": "1.0.2"
}
PKna�\�;5//LICENSEnu�[���MIT License

Copyright (c) 2016 Daijirō Wachi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
PKna�\JQۯ�test.jsnu�[���var test = require('tap').test
var meant = require('./')

test('test vs [\'tast\', \'tbst\', \'tcst\', \'foo\']', function (t) {
  var list = meant('test', ['tast', 'tbst', 'tcst', 'foo'])
  t.notEqual(list.indexOf('tast'), -1, 'list has tast')
  t.notEqual(list.indexOf('tbst'), -1, 'list has tbst')
  t.notEqual(list.indexOf('tcst'), -1, 'list has tcst')
  t.equal(list.indexOf('foo'), -1, 'list doesn\'t have foo')
  t.end()
})
PKla�\�!Q��index.jsnu�[���PKma�\�C=%��.github/workflows/ci.ymlnu�[���PKma�\[=�w��	README.mdnu�[���PKma�\�ĈF99CHANGELOG.mdnu�[���PKma�\-�&���package.jsonnu�[���PKna�\�;5//ZLICENSEnu�[���PKna�\JQۯ��test.jsnu�[���PK�