Define to require
When JSHint is enabled, there's a rule that doesn't let you have more than 6 arguments in a function, so the moment you need to add a 7th argument, you need to do a refactoring.
Start file
define( [ 'jquery', 'underscore', 'json', 'benchmark', 'coffee', 'beans', 'hello' ], function($, _, json, benchmark, coffee, beans, hello) { });
End file
define(function(require) { var $ = require('jquery'); var _ = require('underscore'); var json = require('json'); var benchmark = require('benchmark'); var coffee = require('coffee'); var beans = require('beans'); var hello = require('hello'); });
View Diff
1,12c1,9 < define( < [ < 'jquery', < 'underscore', < 'json', < 'benchmark', < 'coffee', < 'beans', < 'hello' < ], < function($, _, json, benchmark, coffee, beans, hello) { < }); --- > define(function(require) { > var $ = require('jquery'); > var _ = require('underscore'); > var json = require('json'); > var benchmark = require('benchmark'); > var coffee = require('coffee'); > var beans = require('beans'); > var hello = require('hello'); > });
Solutions
The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!
Check out these helpful resources to improve your Vim skills... Game on.
Unlock 49 remaining solutions by signing in and submitting your own entry
#50 jonlorusso / @jonlorusso - Score: 291 - 04/26/13 @ 21:27
:set paste<CR>vGCdefine(function(require) {<CR> var $ = require('jquery');<CR> var _ = require('underscore');<CR> var json = require('json');<CR> var benchmark = require('benchmark');<CR> var coffee = require('coffee');<CR> var beans = require('beans');<CR> var hello = require('hello');<CR>});<Esc>ZZ
0 comments