Socket
Book a DemoInstallSign in
Socket

apple-model-names

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apple-model-names

Convert Apple hardware strings into human-readable names

1.1.12
latest
npmnpm
Version published
Weekly downloads
21
-44.74%
Maintainers
2
Weekly downloads
 
Created
Source

Apple Model Names

A tiny helper library to convert Apple hardware strings ("iPhone6,2") into human-readable model names ("iPhone 5s").

Supports the following device hardware strings:

  • 📱: iPhone, iPad (all types), iPod touch
  • 💻: MacBook, MacBook Pro, MacBook Air
  • 🖥: Mac mini, Mac Pro, iMac
  • 📺 Apple TV, ⌚ Apple Watch

Usage

First, install the library:

npm install --save apple-model-names

Then, import and use:

import getModelName from 'apple-model-names';

getModelName('iPhone6,2'); // 'iPhone 5s'
getModelName('iPhone6,2', { split: true }); // ['iPhone', '5s']

// Examples with no matching result
getModelName('iPhone99,9'); // 'iPhone 99,9'
getModelName('iCrazy1,1'); // 'Other'

Options

An options hash can be passed in as a second parameter to customize the return data. Here are the available options:

OptionDefault ValueDescription
splitfalseReturn an array with the device and model split up (i.e. ['iPhone', '5s']). This is useful when needing more fine-grained control, such as styling each piece of text differently in your UI.
noMatchString'Other'The string to return for unrecognized device names.

Translation Sources

The translations are human-curated from various Apple support links and wiki pages. Here are the resources we use:

Missing a new model? Found a bug?

We welcome contributions! Feel free to open an issue (or a PR!) if you notice any missing models (new releases, etc.), or spot a bug. Thanks!

License

Copyright 2018 Google Inc.

Licensed under the MIT License: https://opensource.org/licenses/MIT

Keywords

apple

FAQs

Package last updated on 11 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.