Refactor $wp_scripts init checking code
|Reported by:||GaryJ||Owned by:|
The functions in functions.wp-scripts.php seem to contain a lot of duplicate code in terms of checking and initializing the global $wp_scripts in each function.
Attached is rough first pass at creating a function to do this. I expect aspects of it could be done better.
I've included the first argument, to avoid relying on a global so that the function might be unit tested (pass something in, see what gets returned).