aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorStephen Blott2016-03-26 12:53:40 +0000
committerStephen Blott2016-03-26 13:20:51 +0000
commita1103158551ace4232b613d290f5d193a7c5185f (patch)
tree387ca18eb54814e33f670a96ecb82c8d6d0c69e8 /lib
parentbfeaeae0df589e5163cdc9e99ea9d3c3b1b15038 (diff)
downloadvimium-a1103158551ace4232b613d290f5d193a7c5185f.tar.bz2
Multiple minor tweaks.
Some of this code is showing its age, so these are just a number of minor tweaks (to keep things clear, consistent and concise). Also, add a couple of tests (while we're at it).
Diffstat (limited to 'lib')
-rw-r--r--lib/clipboard.coffee2
-rw-r--r--lib/utils.coffee6
2 files changed, 3 insertions, 5 deletions
diff --git a/lib/clipboard.coffee b/lib/clipboard.coffee
index f0fb83b1..af143dd9 100644
--- a/lib/clipboard.coffee
+++ b/lib/clipboard.coffee
@@ -6,7 +6,7 @@ Clipboard =
textArea
# http://groups.google.com/group/chromium-extensions/browse_thread/thread/49027e7f3b04f68/f6ab2457dee5bf55
- copy: (data) ->
+ copy: ({data}) ->
textArea = @_createTextArea()
textArea.value = data
diff --git a/lib/utils.coffee b/lib/utils.coffee
index 3b2a59a4..31bb47b6 100644
--- a/lib/utils.coffee
+++ b/lib/utils.coffee
@@ -162,10 +162,8 @@ Utils =
# Transform "zjkjkabz" into "abjkz".
distinctCharacters: (str) ->
- unique = ""
- for char in str.split("").sort()
- unique += char unless 0 <= unique.indexOf char
- unique
+ chars = str.split("").sort()
+ (ch for ch, index in chars when index == 0 or ch != chars[index-1]).join ""
# Compares two version strings (e.g. "1.1" and "1.5") and returns
# -1 if versionA is < versionB, 0 if they're equal, and 1 if versionA is > versionB.