script.js
script.js copied to clipboard
$script.order() mutate the paths array parameter
import scriptjs from 'scriptjs';
const LIBS = ['url/to/main/lib.js', 'url/to/dep/lib.js'];
scriptjs.order(LIBS, () => done());
scriptjs.order(LIBS, () => done());
The second one will throw an error because LIBS will be mutated with the .shift() and will be empty.