Real Vim ninjas count every keystroke - do you?

Pick a challenge, fire up Vim, and show us what you got.

Changelog, Rules & FAQ, updates: @vimgolf, RSS.

Your VimGolf key: please sign in

$ gem install vimgolf
$ vimgolf setup
$ vimgolf put 58753af0f5ef5c0006000006

Change attribute to getter

Wrap attributes with a getter method.

Start file
function() {
  var a = thing.index < other.attribute;
  var b = thing.index < other.attribute;
  var c = thing.attribute < other.index;
  var d = thing.attribute < other.index;
}
End file
function() {
  var a = thing.get('index') < other.get('attribute');
  var b = thing.get('index') < other.get('attribute');
  var c = thing.get('attribute') < other.get('index');
  var d = thing.get('attribute') < other.get('index');
}

View Diff

2,5c2,5
<   var a = thing.index < other.attribute;
<   var b = thing.index < other.attribute;
<   var c = thing.attribute < other.index;
<   var d = thing.attribute < other.index;
---
>   var a = thing.get('index') < other.get('attribute');
>   var b = thing.get('index') < other.get('attribute');
>   var c = thing.get('attribute') < other.get('index');
>   var d = thing.get('attribute') < other.get('index');

Solutions by @Smylers2:

Unlock 5 remaining solutions by signing in and submitting your own entry
Created by: @wyne

44 active golfers, 98 entries

Solutions by @Smylers2:
24
#2 - Smylers / @Smylers2

01/10/2017 at 09:57PM

25
#>28 - Smylers / @Smylers2

01/10/2017 at 09:53PM

26
#>35 - Smylers / @Smylers2

01/10/2017 at 09:50PM

29
#>37 - Smylers / @Smylers2

01/10/2017 at 09:46PM

29
#>37 - Smylers / @Smylers2

01/10/2017 at 10:02PM