The Wayback Machine - https://web.archive.org/web/20201030063839/https://github.com/Mrtenz/tab-completion
Skip to content
This repository has been archived by the owner. It is now read-only.
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

tab-completion

A simple to use utility for tab completion. It will match the user input with a list of possible values, based on the Levenshtein distance. It is made for usage in a browser or with Node.js.

Installation

It is recommended to use yarn or npm to install the library.

$ yarn add tab-completion

It is also possible to copy the lib/tabCompletion.js file and include it in your project.

Usage

If you use a module bundler such as Webpack you can simply use ES6 imports to load the module. If you load the JS file directly in the browser, you can use window.TabCompletion instead.

Example

import { tabComplete } from 'tab-completion';

const values = ['foo bar', 'baz qux'];

const match = tabComplete(values, 'foo');
console.log(match); // foo bar

API

tabComplete(values, input, options);
  • values is a string array containing the possible values.
  • input is the user input to tab complete.
  • options (optional) is an object containing the options.
    • minLength the minimum length for the user input to match a value. Defaults to 3.

About

A simple to use utility for tab completion.

Topics

Resources

License

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.