diff options
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.  | 
