mirror of
https://github.com/balena-io/balena-cli.git
synced 2024-12-29 18:18:50 +00:00
21 lines
516 B
CoffeeScript
21 lines
516 B
CoffeeScript
_ = require('lodash')
|
|
|
|
# TODO: This should be fetch from the server
|
|
DEVICES = require('./device-data.json')
|
|
|
|
exports.getDisplayName = (device) ->
|
|
if _.indexOf(exports.getSupportedDevices(), device) isnt -1
|
|
return device
|
|
|
|
for key, value of DEVICES
|
|
if _.indexOf(value.names, device) isnt -1
|
|
return key
|
|
return 'Unknown'
|
|
|
|
exports.getDeviceSlug = (device) ->
|
|
displayName = exports.getDisplayName(device)
|
|
return DEVICES[displayName]?.slug or 'unknown'
|
|
|
|
exports.getSupportedDevices = ->
|
|
return _.keys(DEVICES)
|