Namespace: Util

Util

Miscellaneous internal utility functions that don't seem to fit anywhere else. You probably won't every need to use any of these, except maybe String.capitalize().

Source:

Methods


<static> Array#commaList()

Source:
Returns:

a proper serial-comma-separated description of the list including "and", or "nothing" if the list is empty.

Type
string
Examples
alert( [ "a two-dollar pistol", "a Stetson hat", "a shotgun" ].commaList() );
// prints "a two-dollar pistol, a Stetson hat, and a shotgun"
alert( [ "a two-dollar pistol", "a Stetson hat" ].commaList() );
// prints "a two-dollar pistol and a Stetson hat"
alert( [ "a two-dollar pistol" ].commaList() );
// prints "a two-dollar pistol"
alert( [].commaList() );
// prints "nothing"

<static> Array#aList()

Source:
Returns:

a commaList() of an array of PersistentObjects' .aName fields.

Type
string

<static> Array#theList()

Source:
Returns:

a commaList() of an array of PersistentObjects' .theName fields.

Type
string

<static> String#capitalize()

FIXME: This doesn't work if the first character is a quotation mark or other punctuation, or a number. Does it need to?

Source:
Returns:

the string with the first character capitalized.

Type
string
Example
// given that some_widget.name == "widget"...
alert( obj("some_widget").aName.capitalize() + " sure is a good thing to have!" );
// prints "A widget sure is a good thing to have!"