Util
Classes
Methods
-
static blobToDataUrl(blob) → {Promise.<String>}
-
Take a Blob and convert it to a data URL.
Parameters:
Name Type Description blobBlob -
static blobToString(blob) → {Promise.<String>}
-
Take a Blob and convert it to a String.
Parameters:
Name Type Description blobBlob -
static dataUrlToBlob(dataUrl) → {Blob}
-
Take a data URL and convert it to a Blob.
Parameters:
Name Type Description dataUrlString 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 mimeTypeString Returns:
String -
static getVoyantDocumentFormatFromFileExtension(fileExtension) → {String}
-
Takes a file extension and returns the corresponding Voyant Document Format name.
Parameters:
Name Type Description fileExtensionString Returns:
String -
static id(len) → {String}
-
Generates a random ID of the specified length.
Parameters:
Name Type Default Description lenNumber 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 loadScript(scriptUrl) → {Promise}
-
Loads an external script for use with your notebook.
Parameters:
Name Type Description scriptUrlString The URL of the script to load.
Returns:
Promise -
static more(before, more, after)
-
Parameters:
Name Type Description beforeString moreString afterString -
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
lenNumber <optional>
A maximum length to trim the contents to
modeString <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 contentsArray | 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 xmlDocDocument | String The XML document to transform
xslStylesheetDocument | String The XSL to use for the transformation
returnDocBoolean <optional>
false True to return a Document, false to return a DocumentFragment
Returns:
Document