TinCan.Utils Class
Item Index
Methods
- convertISO8601DurationToMilliseconds static
- convertMillisecondsToISO8601Duration static
- getBase64String static
- getContentTypeFromHeader static
- getISODateString static
- getLangDictionaryValue
- getServerRoot
- getSHA1String static
- getSHA256String static
- getUUID static
- isApplicationJSON static
- parseURL
- stringFromArrayBuffer static
- stringToArrayBuffer static
Methods
convertISO8601DurationToMilliseconds
-
ISO8601Duration
Parameters:
-
ISO8601Duration
StringDuration in ISO8601 format
Returns:
Duration in milliseconds
Note: does not handle input strings with years, months and days
convertMillisecondsToISO8601Duration
-
inputMilliseconds
Parameters:
-
inputMilliseconds
IntDuration in milliseconds
Returns:
Duration in ISO8601 format
getBase64String
-
str
Parameters:
-
str
StringContent to encode
Returns:
Base64 encoded contents
getContentTypeFromHeader
-
header
Parameters:
-
header
StringContent-Type header value
Returns:
Primary value from Content-Type
getISODateString
-
date
Parameters:
-
date
DateDate to stringify
Returns:
ISO date String
getLangDictionaryValue
-
prop
-
[lang]
Intended to be inherited by objects with properties that store display values in a language based "dictionary"
Parameters:
-
prop
StringProperty name storing the dictionary
-
[lang]
String optionalLanguage to return
Returns:
getServerRoot
-
absoluteUrl
Parameters:
-
absoluteUrl
String
Returns:
server root of url
getSHA1String
-
str
Parameters:
-
str
StringContent to hash
Returns:
SHA1 for contents
getSHA256String
-
content
Parameters:
-
content
ArrayBuffer | StringContent to hash
Returns:
SHA256 for contents
getUUID
()
String
static
Generates a UUIDv4 compliant string that should be reasonably unique
Returns:
UUID
isApplicationJSON
-
header
Parameters:
-
header
StringContent-Type header value
Returns:
whether "application/json" was matched
parseURL
-
url
-
[options]
Parameters:
-
url
String -
[options]
Object optional-
[allowRelative]
Boolean optionalOption to allow relative URLs
-
Returns:
Object of values
stringFromArrayBuffer
-
content
-
[encoding]
Parameters:
-
content
ArrayBufferArrayBuffer of content to convert to a String
-
[encoding]
String optionalEncoding to use for conversion
Returns:
Converted content
stringToArrayBuffer
-
content
-
[encoding]
Parameters:
-
content
StringString of content to convert to an ArrayBuffer
-
[encoding]
String optionalEncoding to use for conversion
Returns:
Converted content