lib/index.js
function devices (port, paths) {
  paths = paths || {}
  var actualPath = defaults(paths, defaultPaths)
  var device = isNaN(port) ? motor() : sensor()

  if (device.prefix === motor().prefix) {
    port = port.toUpperCase()
  }
  if (device.available[device.prefix + port]) {
    return path.join(device.path, device.available[device.prefix + port])
  } else {
    throw new Error('no device in port ' + port)
  }

  function motor () {
    motorCache = isEmpty(motorCache) ? getPaths(actualPath.motor) : motorCache
    return {
      path: actualPath.motor,
      available: motorCache,
      prefix: 'out'
    }
  }

  function sensor () {
    sensorCache = isEmpty(sensorCache) ? getPaths(actualPath.sensor) : sensorCache
    return {
      path: actualPath.sensor,
      available: sensorCache,
      prefix: 'in'
    }
  }
}
function devices (port, paths) {
  paths = paths || {}
  var actualPath = defaults(paths, defaultPaths)
  var device = isNaN(port) ? motor() : sensor()

  if (device.prefix === motor().prefix) {
    port = port.toUpperCase()
  }
  if (device.available[device.prefix + port]) {
    return path.join(device.path, device.available[device.prefix + port])
  } else {
    throw new Error('no device in port ' + port)
  }

  function motor () {
    motorCache = isEmpty(motorCache) ? getPaths(actualPath.motor) : motorCache
    return {
      path: actualPath.motor,
      available: motorCache,
      prefix: 'out'
    }
  }

  function sensor () {
    sensorCache = isEmpty(sensorCache) ? getPaths(actualPath.sensor) : sensorCache
    return {
      path: actualPath.sensor,
      available: sensorCache,
      prefix: 'in'
    }
  }
}
function devices ( port , paths ) { paths = paths || { } var actualPath = defaults ( paths , defaultPaths ) var device = isNaN ( port ) ? motor ( ) : sensor ( ) if ( device . prefix === motor ( ) . prefix ) { port = port . toUpperCase ( ) } if ( device . available [ device . prefix + port ] ) { return path . join ( device . path , device . available [ device . prefix + port ] ) } else { throw new Error ( 'no device in port ' + port ) } function motor ( ) { motorCache = isEmpty ( motorCache ) ? getPaths ( actualPath . motor ) : motorCache return { path : actualPath . motor , available : motorCache , prefix : 'out' } } function sensor ( ) { sensorCache = isEmpty ( sensorCache ) ? getPaths ( actualPath . sensor ) : sensorCache return { path : actualPath . sensor , available : sensorCache , prefix : 'in' } } }
Get a device
@param  {String} port
@return {String} path
Get a device