npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ac

v1.0.2

Published

Autocomplete

Downloads

87

Readme

AutoComplete

Build Status Coverage Status Code Climate Dependencies devDependency Status NPM version

Autocomplete all the words!

Background

The project we are currently working on requires auto-complete with a large number of possible words.

This is an experiment to create a great auto-complete experience on a shoe-string.

Demo: http://wordsy.herokuapp.com/

Tasks

  • [x] Load all the words into LevelDB (no need to setup a Database!)
  • [x] Search for a complete word in LevelDB
  • [x] Search for a partial word (to get suggestions)
  • [x] Implement simple example UI
  • [x] Only start searching for suggestions after the person types second char
  • [ ] When a person clicks on a word in the UI we need to count that as a "vote" for the word, so we can get some stats.
  • [x] Put demo app on Heroku: http://wordsy.herokuapp.com/
  • [x] Remove surplus words files (to reduce bandwidth) note: extended list is: https://github.com/nelsonic/english-words

Example: search for the first four characters of the word awesome:

Returns the following four words:

awesome
awesomely
awesomeness
awest

Got Coverage ?

npm run-script cover

Ideas (remind me to do these later)

  • [ ] Use the zipped version of the words.txt file to reduce bandwidth when installing the the module.

  • [ ] delete un-compressed version of words.txt

  • [ ] Use Socket.io for faster transport of characters and suggestions.

Research

Existing Autocompletion Libraries

There are several solutions to the autocomplete/autosuggest problem. The two most popular are:

  • JQuery AutoComplete: http://jqueryui.com/autocomplete/
  • Typeahead.js (by Twitter): https://twitter.github.io/typeahead.js/

JQuery AutoComplete is Clunky and requires JQuery UI (#bloatware) try the demo on a mobile device: http://jqueryui.com/autocomplete/#remote to see what I mean.

Typeahead is quite slick. See: https://twitter.github.io/typeahead.js/examples but is focussed on the front-end. I needed the back-end component. (i.e. a fast way of returning word suggestions from a large dictionary of words - not just a small list of US States or Cities)

~~Which Database~~ Why LevelDB?

  • Zero installation or configuration required. #winning
  • Benchmarks: http://leveldb.googlecode.com/svn/trunk/doc/benchmark.html
  • LevelDB with Node: http://dailyjs.com/2013/05/03/leveldb-and-node-2/
  • Try/learn it: http://nodeschool.io/#levelmeup
  • Great documentaion at: https://github.com/rvagg/node-levelup
  • Another intro: https://medium.com/node-js-javascript/the-ultimate-database-of-the-future-45e0d00f153c

Media Wiki API

  • [ ] http://www.mediawiki.org/wiki/API:Main_page