1.1.12 • Published 5 years ago

apple-model-names v1.1.12

Weekly downloads
12
License
MIT
Repository
-
Last release
5 years ago

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

1.1.12

5 years ago

1.1.11

6 years ago

1.1.10

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

7 years ago

1.1.5

7 years ago

1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago