is_customize_preview() like function to check if Customizer “Live Preview” in JavaScript

you can just check for the customize object, but if you absolutely need a conditional statement to determine whatever it is you need, you can do something like this:

jQuery( function( $ ) {

    // set var
    var in_customizer = false;

    // check for wp.customize return boolean
    if ( typeof wp !== 'undefined' ) {
        in_customizer =  typeof wp.customize !== 'undefined' ? true : false;
    }

    // if you're in the customizer do this
    if ( in_customizer ) {
        console.log('in customizer');

    // if you're not in the customizer do this
    } else {
        console.log('not in customizer');
    }

});