src/classes/class-wp-enqueue-util.php
public function enqueue_script( WP_Enqueue_Options $options ) {

        if ( ! $options->have_required_properties() ) {

            trigger_error( 'Trying to enqueue script, but required properties are missing.' );

            return;

        }

        // Required options.
        $handle = $options->get_handle();
        $relative_path = $options->get_relative_path();
        $filename = $options->get_filename();

        // Optional options.
        $filename_debug = $options->get_filename_debug();
        $dependencies = $options->get_dependencies();
        $version = $options->get_version();
        $in_footer = $options->get_in_footer();

        // Localization options.
        $localization_name = $options->get_localization_name();
        $data = $options->get_data();

        $source = $this->get_source_to_enqueue( $relative_path, $filename, $filename_debug );

        wp_register_script(
            $handle,
            $source,
            $dependencies,
            $version,
            $in_footer
        );

        if ( ! empty( $localization_name ) && ! empty( $data ) ) {

            wp_localize_script(
                $handle,
                $localization_name,
                $data
            );

        }

        wp_enqueue_script( $handle );

    }
public function enqueue_script( WP_Enqueue_Options $options ) {

        if ( ! $options->have_required_properties() ) {

            trigger_error( 'Trying to enqueue script, but required properties are missing.' );

            return;

        }

        // Required options.
        $handle = $options->get_handle();
        $relative_path = $options->get_relative_path();
        $filename = $options->get_filename();

        // Optional options.
        $filename_debug = $options->get_filename_debug();
        $dependencies = $options->get_dependencies();
        $version = $options->get_version();
        $in_footer = $options->get_in_footer();

        // Localization options.
        $localization_name = $options->get_localization_name();
        $data = $options->get_data();

        $source = $this->get_source_to_enqueue( $relative_path, $filename, $filename_debug );

        wp_register_script(
            $handle,
            $source,
            $dependencies,
            $version,
            $in_footer
        );

        if ( ! empty( $localization_name ) && ! empty( $data ) ) {

            wp_localize_script(
                $handle,
                $localization_name,
                $data
            );

        }

        wp_enqueue_script( $handle );

    }
A convenience function for enqueuing scripts.

Will automatically enqueue concat or minified source, depending on debug configuration.
Will automatically add localization if name and data are provided.

@param WP_Enqueue_Options $options Options to enqueue script with.