Util
Classes
Methods
-
static blobToDataUrl(blob) → {Promise.<String>}
-
Take a Blob and convert it to a data URL.
Parameters:
Name Type Description blob
Blob -
static blobToString(blob) → {Promise.<String>}
-
Take a Blob and convert it to a String.
Parameters:
Name Type Description blob
Blob -
static dataUrlToBlob(dataUrl) → {Blob}
-
Take a data URL and convert it to a Blob.
Parameters:
Name Type Description dataUrl
String Returns:
Blob -
static getFileExtensionFromMimeType(mimeType) → {String}
-
Takes a MIME type and returns the related file extension. Only handles file types supported by Voyant.
Parameters:
Name Type Description mimeType
String Returns:
String -
static getVoyantDocumentFormatFromFileExtension(fileExtension) → {String}
-
Takes a file extension and returns the corresponding Voyant Document Format name.
Parameters:
Name Type Description fileExtension
String Returns:
String -
static id(len) → {String}
-
Generates a random ID of the specified length.
Parameters:
Name Type Default Description len
Number 8 The length of the ID to generate?
Returns:
String -
static isArray(val) → {Boolean}
-
Returns true if the value is an Array.
Parameters:
Name Type Description val
* Returns:
Boolean -
static isBlob(val) → {Boolean}
-
Returns true if the value is a Blob.
Parameters:
Name Type Description val
* Returns:
Boolean -
static isBoolean(val) → {Boolean}
-
Returns true if the value is a Boolean.
Parameters:
Name Type Description val
* Returns:
Boolean -
static isFunction(val) → {Boolean}
-
Returns true if the value is a Function.
Parameters:
Name Type Description val
* Returns:
Boolean -
static isNode(val) → {Boolean}
-
Returns true if the value is a Node.
Parameters:
Name Type Description val
* Returns:
Boolean -
static isNull(val) → {Boolean}
-
Returns true if the value is Null.
Parameters:
Name Type Description val
* Returns:
Boolean -
static isNumber(val) → {Boolean}
-
Returns true if the value is a Number.
Parameters:
Name Type Description val
* Returns:
Boolean -
static isObject(val) → {Boolean}
-
Returns true if the value is an Object.
Parameters:
Name Type Description val
* Returns:
Boolean -
static isPromise(val) → {Boolean}
-
Returns true if the value is a Promise.
Parameters:
Name Type Description val
* Returns:
Boolean -
static isString(val) → {Boolean}
-
Returns true if the value is a String.
Parameters:
Name Type Description val
* Returns:
Boolean -
static isUndefined(val) → {Boolean}
-
Returns true if the value is Undefined.
Parameters:
Name Type Description val
* Returns:
Boolean -
static more(before, more, after)
-
Parameters:
Name Type Description before
String more
String after
String -
static show(contents, lenopt, modeopt)
-
Show contents in the results area. Will try to intelligently handle most types of content.
Parameters:
Name Type Attributes Default Description contents
* The contents to show
len
Number <optional>
A maximum length to trim the contents to
mode
String <optional>
info A CSS class to apply to the shown contents
-
static showError(error, moreopt)
-
Show an error in the results area.
Parameters:
Name Type Attributes Description error
* An Error to display
more
* <optional>
Additional Error details
-
static toString(contents) → {String}
-
Parameters:
Name Type Description contents
Array | Object | String Returns:
String -
static transformXml(xmlDoc, xslStylesheet, returnDocopt) → {Document}
-
Takes an XML document and XSL stylesheet and returns the resulting transformation.
Parameters:
Name Type Attributes Default Description xmlDoc
Document | String The XML document to transform
xslStylesheet
Document | String The XSL to use for the transformation
returnDoc
Boolean <optional>
false True to return a Document, false to return a DocumentFragment
Returns:
Document