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 🙏

© 2026 – Pkg Stats / Ryan Hefner

location-picker

v2.0.0

Published

An open source location picker plugin using Google Maps v3 that works with all JavaScript flavors!

Readme

location-picker

CI npm version npm downloads License: MIT

An open source location picker plugin using Google Maps v3, written in modern TypeScript, shipped as both ESM and CJS with full type definitions.

v2 is a modernization release. See the Migration from v1 section below.


Install

npm install location-picker

You also need the Google Maps JavaScript API loaded on your page (either via the classic script tag or the official @googlemaps/js-api-loader).

Usage

ESM (bundlers / modern browsers)

import { LocationPicker } from 'location-picker';
import 'location-picker/style.css';

const lp = new LocationPicker(
  'map',
  { setCurrentPosition: true, onLocationChange: (p) => console.log(p) },
  { zoom: 15 },
);

CommonJS

const { LocationPicker } = require('location-picker');
require('location-picker/style.css');

const lp = new LocationPicker('map');

AdvancedMarkerElement

If you load the Google Maps marker library, set useAdvancedMarker: true and the picker will use google.maps.marker.AdvancedMarkerElement instead of the CSS-pin overlay:

const lp = new LocationPicker('map', { useAdvancedMarker: true }, { mapId: 'YOUR_MAP_ID' });

API

new LocationPicker(element, options?, mapOptions?)

  • element: string | HTMLElement - element id or DOM node.
  • options: LocationPickerOptions:
    • setCurrentPosition?: boolean - default true. Skipped if lat/lng provided.
    • lat?: number, lng?: number - initial center.
    • useAdvancedMarker?: boolean - default false.
    • onLocationChange?: (pos: LatLng) => void - called on each idle event.
  • mapOptions: google.maps.MapOptions - forwarded to new google.maps.Map.

Methods

  • getMarkerPosition(): { lat: number; lng: number }
  • setLocation(lat: number, lng: number): void
  • setCurrentPosition(): Promise<{ lat: number; lng: number }> - breaking in v2, now returns a Promise.
  • destroy(): void - removes listeners and the marker DOM.

Types

import type { LatLng, LocationPickerOptions } from 'location-picker';

Migration from v1

| v1 | v2 | | ---------------------------------------------- | ----------------------------------------------------------------------- | | import LocationPicker from 'location-picker' | Still works. Also: import { LocationPicker } from 'location-picker'. | | setCurrentPosition() returned void | Returns Promise<LatLng>. Rejects on failure instead of console.log. | | UMD / minified UMD bundle | Removed. Use ESM (dist/index.mjs) or CJS (dist/index.cjs). | | @types/googlemaps | Replaced by @types/google.maps. | | CSS was bundled automatically | Now opt-in: import 'location-picker/style.css'. | | No destroy() | destroy() available for cleanup (SPAs, HMR). | | No idle callback | onLocationChange option. | | No AdvancedMarker | useAdvancedMarker: true opts into AdvancedMarkerElement. |

Node >=18 is required to build/develop the library. Consumers are unaffected.

Development

npm install
npm run lint
npm run typecheck
npm run test
npm run build

License

MIT