blinkstick.js
function findBlinkSticks (filter) {
    if (filter === undefined) filter = function () { return true; };

    var result = [], device, i, devices;

    if (isWin) {
        devices = usb.devices();

        for (i in devices) {
            device = devices[i];

            if (device.vendorId === VENDOR_ID &&
                device.productId === PRODUCT_ID &&
                    filter(device))
                {
                    result.push(new BlinkStick(device.path, device.serialNumber, device.manufacturer, device.product));
                }
        }

    } else {
        devices = usb.getDeviceList();

        for (i in devices) {
            device = devices[i];
            if (device.deviceDescriptor.idVendor === VENDOR_ID &&
                device.deviceDescriptor.idProduct === PRODUCT_ID &&
                    filter(device))
                result.push(new BlinkStick(device));
        }
    }

    return result;
}
function findBlinkSticks (filter) {
    if (filter === undefined) filter = function () { return true; };

    var result = [], device, i, devices;

    if (isWin) {
        devices = usb.devices();

        for (i in devices) {
            device = devices[i];

            if (device.vendorId === VENDOR_ID &&
                device.productId === PRODUCT_ID &&
                    filter(device))
                {
                    result.push(new BlinkStick(device.path, device.serialNumber, device.manufacturer, device.product));
                }
        }

    } else {
        devices = usb.getDeviceList();

        for (i in devices) {
            device = devices[i];
            if (device.deviceDescriptor.idVendor === VENDOR_ID &&
                device.deviceDescriptor.idProduct === PRODUCT_ID &&
                    filter(device))
                result.push(new BlinkStick(device));
        }
    }

    return result;
}
function findBlinkSticks ( filter ) { if ( filter === undefined ) filter = function ( ) { return true ; } ; var result = [ ] , device , i , devices ; if ( isWin ) { devices = usb . devices ( ) ; for ( i in devices ) { device = devices [ i ] ; if ( device . vendorId === VENDOR_ID && device . productId === PRODUCT_ID && filter ( device ) ) { result . push ( new BlinkStick ( device . path , device . serialNumber , device . manufacturer , device . product ) ) ; } } } else { devices = usb . getDeviceList ( ) ; for ( i in devices ) { device = devices [ i ] ; if ( device . deviceDescriptor . idVendor === VENDOR_ID && device . deviceDescriptor . idProduct === PRODUCT_ID && filter ( device ) ) result . push ( new BlinkStick ( device ) ) ; } } return result ; }
Find BlinkSticks using a filter.

@method findBlinkSticks
@param {Function} [filter] Filter function.
@return {Array} BlickStick objects.
Find BlinkSticks using a filter .