Skip to main content

Core/Utils

Functions

FunctionDescription
addLeadingSlashAdds a leading slash to a string if missing.
addTrailingSlashAdds a trailing slash to a URL if missing.
cleanObject-
compareVersionsCompares two version strings (e.g. "1.2.3").
convertToTextConverts an object to a string representation.
debounceDebounces a function call by a delay.
deepMergeDeep merges two or three objects.
deferredToPromiseConverts a jQuery Deferred to a native Promise.
fixColorHashAdds a hash to a color string if missing.
functionFromStringConverts a string to a function.
geocode-
getBrowserGets browser info (IE, Firefox, Safari).
getDeviceDetects if the device is iOS or Android.
getDomain-
getFileTypeGets the file type from a URL.
getMouseCoordsGets mouse or touch coordinates from an event.
getNestedValueGets a nested value from an object using dot or PHP-style bracket notation.
getUserAgentGets the user agent string in lowercase.
handleFailedRequestHandles a failed AJAX request and shows a growl error.
idGeneratorGenerator function that creates a unique ID sequence.
isMacChecks if the current OS is Mac.
isNumberChecks if a value is a number.
isPhoneChecks if the device is a phone (max-width: 767px).
isRemoteUrl-
isTabletChecks if the device is a tablet (min-width: 768px and max-width: 1024px).
isTouchDeviceChecks if the current device supports touch events.
isValidURLValidates a URL.
loadFileLoads a single JS or CSS file.
loadFilesLoads multiple files (JS or CSS).
parseBooleanParses a string to boolean.
removeLeadingSlashRemoves a leading slash from a string.
safeURLNormalizes a URL by removing the protocol and domain.
sameDomain-
setNestedPropertySets or deletes a nested property in an object using PHP-style bracket notation. If value is null or undefined, deletes the property and cleans up empty parents.
splitObjectAndField-
throttleThrottles a function call by a delay.
toSnakeCaseConverts a string to snake_case.
ucfirstUppercases the first character of a string.
useIdReturns the next unique ID in the sequence.

Variables

VariableDescription
default-
env-
files-
funcs-
http-
numbers-
strings-