Update common-functions.js

Updated the extend function.