Utility functions
- Source:
Namespaces
Methods
(static) computerFileSize(string) → {number}
Returns a file size in bytes from a humanly readable string
Makes 2kB to 2048.
Inspired by computerFileSize in helper.php
Parameters:
Name | Type | Description |
---|---|---|
string |
string | file size in human readable format |
- Source:
Returns:
or null if string could not be parsed
- Type
- number
(static) formatDate(timestamp, format) → {string}
Parameters:
Name | Type | Description |
---|---|---|
timestamp |
||
format |
- Source:
Returns:
timestamp formatted as requested
- Type
- string
(static) getScrollBarWidth() → {int}
Returns the width of a generic browser scrollbar
- Source:
Returns:
width of scrollbar
- Type
- int
(static) isCookieSetToValue(name, value) → {boolean}
Checks if a cookie with the given name is present and is set to the provided value.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | name of the cookie |
value |
string | value of the cookie |
- Source:
Returns:
true if the cookie with the given name has the given value
- Type
- boolean
(static) isIE() → {bool}
Returns whether this is IE
- Source:
Returns:
true if this is IE, false otherwise
- Type
- bool
(static) naturalSortCompare(a, b)
Compare two strings to provide a natural sort
Parameters:
Name | Type | Description |
---|---|---|
a |
first string to compare | |
b |
second string to compare |
- Source:
Returns:
-1 if b comes before a, 1 if a comes before b
or 0 if the strings are identical
(static) relativeModifiedDate(timestamp) → {string}
Parameters:
Name | Type | Description |
---|---|---|
timestamp |
- Source:
Returns:
human readable difference from now
- Type
- string
(static) stripTime(date) → {Date}
Remove the time component from a given date
Parameters:
Name | Type | Description |
---|---|---|
date |
Date | date |
- Source:
Returns:
date with stripped time
- Type
- Date
(static) waitFor(callback, interval)
Calls the callback in a given interval until it returns true
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | |
interval |
integer | in milliseconds |
- Source: