modules/utils.js
function isValidSelector(value) {
    "use strict";
    if (isString(value)) {
        try {
            // phantomjs env has a working document object, let's use it
            document.querySelector(value);
        } catch(e) {
            if ('name' in e && (e.name === 'SYNTAX_ERR' || e.name === 'SyntaxError')) {
                return false;
            }
        }
        return true;
    } else if (isObject(value)) {
        if (!value.hasOwnProperty('type')) {
            return false;
        }
        if (!value.hasOwnProperty('path')) {
            return false;
        }
        if (['css', 'xpath'].indexOf(value.type) === -1) {
            return false;
        }
        return true;
    }
    return false;
}
function isValidSelector(value) {
    "use strict";
    if (isString(value)) {
        try {
            // phantomjs env has a working document object, let's use it
            document.querySelector(value);
        } catch(e) {
            if ('name' in e && (e.name === 'SYNTAX_ERR' || e.name === 'SyntaxError')) {
                return false;
            }
        }
        return true;
    } else if (isObject(value)) {
        if (!value.hasOwnProperty('type')) {
            return false;
        }
        if (!value.hasOwnProperty('path')) {
            return false;
        }
        if (['css', 'xpath'].indexOf(value.type) === -1) {
            return false;
        }
        return true;
    }
    return false;
}
function isValidSelector ( value ) { "use strict" ; if ( isString ( value ) ) { try { // phantomjs env has a working document object, let's use it document . querySelector ( value ) ; } catch ( e ) { if ( 'name' in e && ( e . name === 'SYNTAX_ERR' || e . name === 'SyntaxError' ) ) { return false ; } } return true ; } else if ( isObject ( value ) ) { if ( ! value . hasOwnProperty ( 'type' ) ) { return false ; } if ( ! value . hasOwnProperty ( 'path' ) ) { return false ; } if ( [ 'css' , 'xpath' ] . indexOf ( value . type ) === - 1 ) { return false ; } return true ; } return false ; }
Checks if value is a valid selector Object.

@param  mixed  value
@return Boolean
Checks if value is a valid selector Object .