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

apple-mapkit-js

v6.1.0

Published

An NPM installable package of Apple's Mapkit JS

Downloads

2,402

Readme

apple-mapkit-js

An NPM installable package of Apple's Mapkit JS Version 5.4.0

Run npm install --save apple-mapkit-js to add this package as a dependency of your project. Then, somewhere in your app, import apple-mapkit-js. ( vis. import 'apple-mapkit-js'; or require('apple-mapkit-js') ). Doing so will create a mapkit object in your app's global scope. This object is the same object you would get if you included the following script tag somewhere in a webpage:

<script src="https://cdn.apple-mapkit.com/mk/5.4.0/mapkit.js"></script>

However, npm installing this script into your app allows you to use a tool like Webpack to bake Apple Mapkit JS into your app without first sending an HTTP GET request to Apple's CDN--making your app a little faster to load in browser.

Load specific Versions of Mapkit JS

To load a specific version of Mapkit JS, require(apple-mapkit-js/ver/5.29.0/mapkit.js) it. See the ver/ directory in this repo for which versions of Mapkit JS are available.

Contains Method

If you include the apple-mapkit-js/contains.js file in this repo after including the main apple-mapkit-js module, all of the region-like objects included with Apple Mapkit JS will be decorated with a prototype function contains(point).

All of these functions take in a point-like object as their first and only argument--and return whether or not that point is contained by the given region.

For example:

require('apple-mapkit-js');
require('apple-mapkit-js/contains');

var map = new mapkit.Map();

map.contains(point);                 // Returns true if point is in map's visible region.
map.region.contains(point);          // Returns true if point is in region.
map.visibleRectArea.contains(point); // Returns true if point is in MapRect.

where point above can be an instance of mapkit.MapPoint, mapkit.Coordinate, a map-point literal of the form { x: Number, y: Number }, or a coordinate literal of form { latitude: Number, longitude: Number }.