'use strict';

import {
  Platform,
  NativeModules
} from 'react-native';

const USBSerialModule = NativeModules.USBSerial;

class USBSerial {
    constructor() {
        super();

        if (Platform.OS != 'android') {
            throw 'Unfortunately only android is supported';
        }
    }

    async getDeviceList() {
        let deviceList = await USBSerialModule.getDeviceList();

        return deviceList;
    }
}

modules.exports =

'use strict';

import {
  Platform,
  NativeModules
} from 'react-native';

const USBSerialModule = NativeModules.USBSerial;

class USBSerial {
    constructor() {

        if (Platform.OS != 'android') {
            throw 'Unfortunately only android is supported';
        }
    }

    async getDeviceList() {
        let deviceList = await USBSerialModule.getDeviceList();

        return deviceList;
    }
}

module.exports = USBSerial;

Fix errors in the index.js