copy the code of underscore.js