if custom posts type exists and there are posts load script

I’m at work at the moment (sorry boss), so I can’t test this, but the snippet below should be the proper way of testing if the ‘featured_post’ post type exists, and then enqueue the script if it has any posts.

if ( is_front_page() && post_type_exists('featured_post') ) { // We are at the front page, and the post type 'featured_post' is registered.
    $hasposts = get_posts( 'post_type=featured_post' ); // lets check if there is any posts in the 'featured_post' post type.
    if( $hasposts ) { // If we found some posts, lets enqueue the script
        wp_enqueue_script ('flexslider-js');
    }
}