Extract `extend.js` for testing.