Maybe just `if (key.indexOf("grunt-") === 0) grunt.loadNpmTasks(key);`?