default
Variable: default
Section titled “Variable: default”const default: object;Type declaration
Section titled “Type declaration”env: object;env.getBrowser()
Section titled “env.getBrowser()”getBrowser: () => object;Gets browser info (IE, Firefox, Safari).
Returns
Section titled “Returns”object
firefox
Section titled “firefox”firefox: boolean;ie: boolean;safari
Section titled “safari”safari: boolean;env.getDevice()
Section titled “env.getDevice()”getDevice: () => object;Detects if the device is iOS or Android.
Returns
Section titled “Returns”object
android
Section titled “android”android: boolean;ios: boolean;env.getMouseCoords()
Section titled “env.getMouseCoords()”getMouseCoords: (e) => object;Gets mouse or touch coordinates from an event.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
e | MouseEvent | TouchEvent | TriggeredEvent<any, any, any, any> |
Returns
Section titled “Returns”object
x: number;y: number;env.getUserAgent()
Section titled “env.getUserAgent()”getUserAgent: () => string;Gets the user agent string in lowercase.
Returns
Section titled “Returns”string
env.isMac()
Section titled “env.isMac()”isMac: () => boolean;Checks if the current OS is Mac.
Returns
Section titled “Returns”boolean
env.isPhone()
Section titled “env.isPhone()”isPhone: () => boolean;Checks if the device is a phone (max-width: 767px).
Returns
Section titled “Returns”boolean
files: object;files.getFileType()
Section titled “files.getFileType()”getFileType: (url) => "JS" | "CSS" | "Unknown";Gets the file type from a URL.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
url | any |
Returns
Section titled “Returns”"JS" | "CSS" | "Unknown"
“JS”, “CSS”, or “Unknown”
files.loadFile()
Section titled “files.loadFile()”loadFile: (file) => Promise<unknown>;Loads a single JS or CSS file.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
file | any |
Returns
Section titled “Returns”Promise<unknown>
files.loadFiles()
Section titled “files.loadFiles()”loadFiles: (files) => Promise<any[]>;Loads multiple files (JS or CSS).
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
files | any |
Returns
Section titled “Returns”Promise<any[]>
funcs: object;funcs.deepMerge()
Section titled “funcs.deepMerge()”deepMerge: {<T, U> (target, source): T & U;<T, U, V> (target, middle, source): T & U & V;};Call Signature
Section titled “Call Signature”<T, U>(target, source): T & U;Deep merges two or three objects.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
U |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
target | T | |
source | U |
Returns
Section titled “Returns”T & U
Call Signature
Section titled “Call Signature”<T, U, V>( target, middle, source): T & U & V;Deep merges two or three objects.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
U |
V |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
target | T | |
middle | U | |
source | V |
Returns
Section titled “Returns”T & U & V
funcs.geocode()
Section titled “funcs.geocode()”geocode: (query, callback) => boolean;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
query | any |
callback | any |
Returns
Section titled “Returns”boolean
funcs.getNestedValue()
Section titled “funcs.getNestedValue()”getNestedValue: (obj, path) => any;Gets a nested value from an object using dot or PHP-style bracket notation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
obj | any | The object to traverse. |
path | string | The path string (e.g. ‘a.b.c’ or ‘a[b][c]’). |
Returns
Section titled “Returns”any
The value at the nested path, or undefined if not found.
Example
Section titled “Example”getNestedValue(obj, 'a.b.c')getNestedValue(obj, 'a[b][c]')funcs.splitObjectAndField()
Section titled “funcs.splitObjectAndField()”splitObjectAndField: (fields) => object;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
fields | string |
Returns
Section titled “Returns”object
field: string;object
Section titled “object”object: string;funcs.throttle()
Section titled “funcs.throttle()”throttle: (method, delay, scope, params) => void;Throttles a function call by a delay.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
method | any | |
delay | any | |
scope | any | |
params | any |
Returns
Section titled “Returns”void
http: object;http.handleFailedRequest()
Section titled “http.handleFailedRequest()”handleFailedRequest: (response) => void;Handles a failed AJAX request and shows a growl error.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
response | any |
Returns
Section titled “Returns”void
numbers
Section titled “numbers”numbers: object;numbers.compareVersions()
Section titled “numbers.compareVersions()”compareVersions: (v1, v2) => -1 | 0 | 1;Compares two version strings (e.g. “1.2.3”).
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
v1 | any | |
v2 | any |
Returns
Section titled “Returns”-1 | 0 | 1
1 if v1 > v2, -1 if v1 < v2, 0 if equal
numbers.isNumber()
Section titled “numbers.isNumber()”isNumber: (n) => boolean;Checks if a value is a number.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
n | any |
Returns
Section titled “Returns”boolean
numbers.parseBoolean()
Section titled “numbers.parseBoolean()”parseBoolean: (string) => boolean;Parses a string to boolean.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
string | any |
Returns
Section titled “Returns”boolean
strings
Section titled “strings”strings: object;strings.convertToText()
Section titled “strings.convertToText()”convertToText: (obj) => any;Converts an object to a string representation.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
obj | any |
Returns
Section titled “Returns”any
strings.fixColorHash()
Section titled “strings.fixColorHash()”fixColorHash: (color) => string;Adds a hash to a color string if missing.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
color | string |
Returns
Section titled “Returns”string
strings.functionFromString()
Section titled “strings.functionFromString()”functionFromString: (string) => SyntaxError | TypeError;Converts a string to a function.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
string | string |
Returns
Section titled “Returns”SyntaxError | TypeError
Function or object {error: "error text"}
strings.removeLeadingSlash()
Section titled “strings.removeLeadingSlash()”removeLeadingSlash: (str) => any;Removes a leading slash from a string.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
str | any |
Returns
Section titled “Returns”any
strings.safeURL()
Section titled “strings.safeURL()”safeURL: (url) => any;Normalizes a URL by removing the protocol and domain.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
url | any |
Returns
Section titled “Returns”any
strings.toSnakeCase()
Section titled “strings.toSnakeCase()”toSnakeCase: (str) => string;Converts a string to snake_case.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
str | string |
Returns
Section titled “Returns”string
strings.ucfirst()
Section titled “strings.ucfirst()”ucfirst: (string) => any;Uppercases the first character of a string.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
string | any |
Returns
Section titled “Returns”any