balena-cli/lib/helpers/helpers.coffee
2014-12-09 14:35:45 -04:00

9 lines
266 B
CoffeeScript

_ = 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)