From e88f622449fb0e86d46b0e19f52dc696cf6d88d1 Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 20 Jun 2012 17:16:58 +0200 Subject: [PATCH] minor cleanup --- source/Ox/js/String.js | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/source/Ox/js/String.js b/source/Ox/js/String.js index 47154e50..962db03a 100644 --- a/source/Ox/js/String.js +++ b/source/Ox/js/String.js @@ -7,16 +7,16 @@ Ox.char = String.fromCharCode; /*@ Ox.clean Remove leading, trailing and double whitespace from a string - > Ox.clean("foo bar") - "foo bar" - > Ox.clean(" foo bar ") - "foo bar" - > Ox.clean(" foo \n bar ") - "foo\nbar" - > Ox.clean(" \nfoo\n\nbar\n ") - "foo\nbar" - > Ox.clean(" foo\tbar ") - "foo bar" + > Ox.clean('foo bar') + 'foo bar' + > Ox.clean(' foo bar ') + 'foo bar' + > Ox.clean(' foo \n bar ') + 'foo\nbar' + > Ox.clean(' \nfoo\n\nbar\n ') + 'foo\nbar' + > Ox.clean(' foo\tbar ') + 'foo bar' @*/ Ox.clean = function(string) { return Ox.filter(Ox.map(string.split('\n'), function(string) { @@ -43,13 +43,13 @@ Ox.endsWith = function(string, substring) { Ox.isValidEmail Tests if a string is a valid e-mail address (str) -> True if the string is a valid e-mail address str Any string - > Ox.isValidEmail("foo@bar.com") + > Ox.isValidEmail('foo@bar.com') true - > Ox.isValidEmail("foo.bar@foobar.co.uk") + > Ox.isValidEmail('foo.bar@foobar.co.uk') true - > Ox.isValidEmail("foo@bar") + > Ox.isValidEmail('foo@bar') false - > Ox.isValidEmail("foo@bar..com") + > Ox.isValidEmail('foo@bar..com') false @*/ Ox.isValidEmail = function(string) { @@ -227,6 +227,7 @@ Ox.parseURL = (function() { }; }()); +// FIXME: can we get rid of this? Ox.parseUserAgent = function(userAgent) { var aliases = { browser: { @@ -368,13 +369,13 @@ Ox.parseUserAgent = function(userAgent) { Ox.repeat Repeat a value multiple times Works for arrays, numbers and strings > Ox.repeat(1, 3) - "111" - > Ox.repeat("foo", 3) - "foofoofoo" + '111' + > Ox.repeat('foo', 3) + 'foofoofoo' > Ox.repeat([1, 2], 3) [1, 2, 1, 2, 1, 2] - > Ox.repeat([{k: "v"}], 3) - [{k: "v"}, {k: "v"}, {k: "v"}] + > Ox.repeat([{k: 'v'}], 3) + [{k: 'v'}, {k: 'v'}, {k: 'v'}] @*/ Ox.repeat = function(value, times) { var ret; @@ -522,7 +523,7 @@ Ox.words Splits a string into words, removing punctuation (string) -> <[s]> Array of words string Any string > Ox.words('Let\'s "split" array-likes into key/value pairs--okay?') - ["let's", "split", "array-likes", "into", "key", "value", "pairs", "okay"] + ['let's', 'split', 'array-likes', 'into', 'key', 'value', 'pairs', 'okay'] @*/ Ox.words = function(string) { var array = string.toLowerCase().split(/\b/),