diff options
| author | Stephen Blott | 2016-03-26 12:53:40 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-03-26 13:20:51 +0000 |
| commit | a1103158551ace4232b613d290f5d193a7c5185f (patch) | |
| tree | 387ca18eb54814e33f670a96ecb82c8d6d0c69e8 /lib/utils.coffee | |
| parent | bfeaeae0df589e5163cdc9e99ea9d3c3b1b15038 (diff) | |
| download | vimium-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/utils.coffee')
| -rw-r--r-- | lib/utils.coffee | 6 |
1 files changed, 2 insertions, 4 deletions
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. |
