diff options
| author | Stephen Blott | 2014-12-21 11:58:01 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2014-12-21 11:58:01 +0000 | 
| commit | b0c9a764c77a451726049a79a19a0fa28ae0b30c (patch) | |
| tree | 1099843afcbf338abdec412bc895460ae43a8a9f /lib | |
| parent | 98fd49a6cfe660c363aecb6ebe0a4cb69342808d (diff) | |
| download | vimium-b0c9a764c77a451726049a79a19a0fa28ae0b30c.tar.bz2 | |
Exclusion; unique keys.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/utils.coffee | 6 | 
1 files changed, 6 insertions, 0 deletions
| diff --git a/lib/utils.coffee b/lib/utils.coffee index b7f8731a..81b0fb49 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -110,6 +110,12 @@ Utils =    # detects both literals and dynamically created strings    isString: (obj) -> typeof obj == 'string' or obj instanceof String +  # Transform "zjkjkabz" into "abjkz". +  uniqueCharacters: (str) -> +    unique = "" +    for char in str.split("").sort() +      unique += char unless 0 <= unique.indexOf char +    unique    # 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. | 
