Skip to content

luan0ap/autocomplete

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Autocomplete

A autocomplete build thought in performance for dalycode problem.

Getting Started

The script is flexible, for use the Autocomplete separadely, just make:

import Autocomplete from './Autocomplete'
import data from './list'

// DataList component 
const DataList = () => (`
<datalist
  data-js="autocomplete"
  id="autocomplete"
  class="datalist">
</datalist>`)

// Option component
const Option = str => (`<option value="${str}">`)

// Get the input
const $input = document.querySelector('input')

// Instance
const List = new Autocomplete( $input, data )

// Create a datalist using this function, passing the Datalist component and Option component
List.create(DataList, Option)

OBS: The list should are organized by letter, sample:

{
  A: [
    // Letters that start with letter A
    'anonymous',
    'assistant'
  ]

  B: [
    // Letters that start with letter B
    'ball',
    'brother,
  ]
}

Prerequisites

Installing

Just clone this repository

git clone https://github.com/luan0ap/autocomplete

Install all dependencies

npm i

And execute using

npm start

About

Autocomplete system. Test by daily code problem

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published