balena-cli/lib/helpers/helpers.coffee

9 lines
266 B
CoffeeScript
Raw Normal View History

2014-11-28 19:36:03 +00:00
_ = require('lodash')
resin = require('../resin')
exports.isDeviceUUIDValid = (uuid, callback) ->
resin.models.device.getAll (error, devices) ->
return callback?(error) if error?
uuidExists = _.findWhere(devices, { uuid })?
return callback(null, uuidExists)