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

address-searcher

v1.12.6

Published

Address searching with typeaheads and multiple choices

Downloads

148

Readme

AddressSearch (Demo)

Dependencies

Address searching with typeaheads and multiple choices

Doc

  • Installation

Simply import Google Places API & AddressSearch into your HTML.


<link rel="stylesheet" href="address-search.min.css">
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places"></script>
<script src="address-search.min.js"></script>
  • How to use

Create a new AddressSearch object with a query String or an Element as the first parameter :

let address = new AddressSearch('div.with[any="selector"]', options, delay);
// OR
let element = document.querySelector('li.terally[any="thing"]');
let address = new AddressSearch(element, options, delay);
  • Options

You can automatically fill inputs with address informations when the user selects an address.
To do that, simply add the information type you want and the selector for the input to fill.

The options object works as follows

// GET THE COMPONENT FULL NAME
typename : 'targetInput[selector]'
// GET THE COMPONENT SHORT NAME
typename_short : 'targetInput[selector]'

Available components:

{
  street_number: '...',
  route: '...',
  country: '...',
  administrative_area_level_1: '...',
  administrative_area_level_2: '...',
  administrative_area_level_3: '...',
  administrative_area_level_4: '...',
  administrative_area_level_5: '...',
  colloquial_area: '...',
  locality: '...',
  sublocality: '...',
  neighborhood: '...',
  premise: '...',
  subpremise: '...',
  postal_code: '...',
  point_of_interest: '...'
}
  • Delay

You can use the third parameter to enter a delay (ms).
This delay will be used before displaying Google API predictions after each keypress.
This can help you mitigate the amount of requests made on your account.

The delay parameter works as follows

new AddressSearch(element, options, 500);
  • Methods

See the documentation for the method definitions.

  • Example

See this JSFiddle for a working example

Authors