Functions
Creates top-level storable collections if they do not exist yet.
parameters
| array | names |
Get a random item from a collection.
parameters
| coll |
examples
randomItem(storage.users)
Sort a collection in reverse chronological order, i.e. newest to oldest.
parameters
| a | ||
| b |
examples
storage.users.sort(newest)
Sort a collection in chronological order, i.e. oldest to newest.
parameters
| a | ||
| b |
examples
storage.users.sort(oldest)
Get an elapsed time in plain English.
parameters
| Date | timestamp |
returns
| string | the relative time since that date, e.g. '3 hours' |
Get an elapsed time in plain English and add a tooltip for the original time.
parameters
| object Date | timestamp |
returns
| object | an HTML abbr tag |
Format GET request parameters.
parameters
| object | object | Your parameters in hash table format. |
| boolean | useCurrent | If true, starts with the current request parameters and builds on top of them. Defaults to false. |
returns
| string | The parameter string! Just add it to the URL and you're good to go. |
Adds the english suffix to a number, e.g. 3.th() -> '3rd'
parameters
| boolean | sup ? | If true, returns inside a span tag with the suffix in superscript. If false, returns a plain string. |
| boolean | caps ? | If true, converts the suffix to uppercase. |
returns
| '3rd' | |
| '3rd ' | |
| '3RD ' | |
| '3RD' |
examples
3.th()
3.th(true)
3.th(true, true)
3.th(false, true)