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

@shotlingo/device-resolutions

v0.1.0

Published

iOS points/scale/pixels/ppi and Android dp/density-bucket/pixels/ppi for every current device class, as a typed lookup table — no network calls, zero dependencies.

Readme

@shotlingo/device-resolutions

iOS points/scale/pixels/ppi and Android dp/density-bucket/pixels/ppi for every current iPhone, iPad, Android phone, and Android tablet class — as a typed lookup table. Zero dependencies, no network calls.

Full interactive reference (searchable table + JSON/CSV export): shotlingo.com/tools/device-resolution-lookup

Install

npm install @shotlingo/device-resolutions

Usage

import { getById, getByPlatform, pxToDp, nearestDensityBucket, DEVICE_RESOLUTIONS } from '@shotlingo/device-resolutions';

getById('iphone-6.9');
// => { id: 'iphone-6.9', platform: 'ios', category: 'iphone', label: 'iPhone 6.9"', logical: { w: 440, h: 956 }, scale: 3, physical: { w: 1320, h: 2868 }, ppi: 460, ... }

getByPlatform('android').map((d) => d.label);
// => ['Pixel 8', 'Pixel 8 Pro', 'Galaxy S23', 'Galaxy S23 Ultra', 'Galaxy Tab S9']

pxToDp(1080, 480);
// => 360

nearestDensityBucket(428).name;
// => 'xxhdpi'

DEVICE_RESOLUTIONS.length;
// => 20

API

  • DEVICE_RESOLUTIONS: DeviceResolution[] — the full device list (iPhone, iPad, Android phone, Android tablet).
  • DENSITY_BUCKETS: DensityBucket[] — the standard Android density buckets (ldpi → xxxhdpi).
  • PLATFORMS: Platform[]'ios' | 'android'.
  • CATEGORIES: DeviceCategory[]'iphone' | 'ipad' | 'android-phone' | 'android-tablet'.
  • getById(id: string): DeviceResolution | undefined — lookup by id, e.g. 'pixel-8' (case-insensitive).
  • getByPlatform(platform: Platform): DeviceResolution[]
  • getByCategory(category: DeviceCategory): DeviceResolution[]
  • getDensityBucket(id: string): DensityBucket | undefined — lookup by bucket id, e.g. 'xxhdpi' (case-insensitive).
  • pxToDp(px: number, ppi: number): number — computed Android dp per the density formula (px ÷ (ppi ÷ 160)). Real hardware rounds to the nearest standard bucket, so treat the result as an estimate.
  • nearestDensityBucket(ppi: number): DensityBucket — the standard bucket whose dpi is closest to a given ppi.

Why this exists

Marketing size names ("6.5-inch", "6.7-inch") don't map 1:1 to pixel grids — several physically-different iPhone classes share a marketing size, and Android manufacturers ship a continuum of real densities instead of the six standard buckets. This package gives you the actual logical/physical/ppi values so screenshot templates and design breakpoints don't drift by a few pixels between "similar" device classes.

License

MIT