Module: odatajs/utils

odatajs/utils

Source:

Methods

<inner> activeXObject(progId) → {Object}

Creates a new ActiveXObject from the given progId.
Parameters:
Name Type Description
progId String ProgId string of the desired ActiveXObject.
Source:
Returns:
The ActiveXObject instance. Null if ActiveX is not supported by the browser. This function throws whatever exception might occur during the creation of the ActiveXObject.
Type
Object

<inner> assigned(value) → {Boolean}

Checks whether the specified value is different from null and undefined.
Parameters:
Name Type Argument Description
value <optional>
Value to check ( may be null)
Source:
Returns:
true if the value is assigned; false otherwise.
Type
Boolean

<inner> contains(arr, item) → {Boolean}

Checks whether the specified item is in the array.
Parameters:
Name Type Argument Description
arr Array <optional>
Array to check in.
item Item to look for.
Source:
Returns:
true if the item is contained, false otherwise.
Type
Boolean

<inner> defined(a, b)

Given two values, picks the first one that is not undefined.
Parameters:
Name Type Description
a First value.
b Second value.
Source:
Returns:
a if it's a defined value; else b.

<inner> delay(callback)

Delays the invocation of the specified function until execution unwinds.
Parameters:
Name Type Description
callback function Callback function.
Source:

<inner> djsassert(condition, message, data)

Throws an exception in case that a condition evaluates to false.
Parameters:
Name Type Description
condition Boolean Condition to evaluate.
message String Message explaining the assertion.
data Object Additional data to be included in the exception.
Source:

<inner> extend(target, values) → {Object}

Extends the target with the specified values.
Parameters:
Name Type Description
target Object Object to add properties to.
values Object Object with properties to add into target.
Source:
Returns:
The target object.
Type
Object

<inner> getURIFromInfo(uriInfo) → {String}

Builds a URI string from its components.
Parameters:
Name Type Description
uriInfo Object An object with uri parts (scheme, authority, etc.).
Source:
Returns:
URI string.
Type
String

<inner> getURIInfo(uri) → {Object}

Gets information about the components of the specified URI.
Parameters:
Name Type Description
uri String URI to get information from.
Source:
Returns:
An object with an isAbsolute flag and part names (scheme, authority, etc.) if available.
Type
Object

<inner> isDate(value) → {Boolean}

Checks whether the specified value is a Date object.
Parameters:
Name Type Description
value Value to check.
Source:
Returns:
true if the value is a Date object; false otherwise.
Type
Boolean

<inner> isObject(value) → {Boolean}

Tests whether a value is an object.
Parameters:
Name Type Description
value Value to test.
Source:
Returns:
True is the value is an object; false otherwise. Per javascript rules, null and array values are objects and will cause this function to return true.
Type
Boolean

<inner> mergeUriPathWithBase(uriPath, basePath) → {String}

Merges the path of a relative URI and a base URI.
Parameters:
Name Type Description
uriPath String Relative URI path.
basePath String Base URI path.
Source:
Returns:
A string with the merged path.
Type
String

<inner> normalizeURI(uri, base) → {String}

Normalizes a possibly relative URI with a base URI.
Parameters:
Name Type Description
uri String URI to normalize, absolute or relative
base String Base URI to compose with (may be null)
Source:
Returns:
The composed URI if relative; the original one if absolute.
Type
String

<inner> normalizeURICase(uri) → {String}

Normalizes the casing of a URI.
Parameters:
Name Type Description
uri String URI to normalize, absolute or relative.
Source:
Returns:
The URI normalized to lower case.
Type
String

<inner> parseInt10(value) → {Number}

Parses a value in base 10.
Parameters:
Name Type Description
value String String value to parse.
Source:
Returns:
The parsed value, NaN if not a valid value.
Type
Number

<inner> removeDotsFromPath(path) → {String}

Removes the special folders . and .. from a URI's path.
Parameters:
Name Type Description
path string URI path component.
Source:
Returns:
Path without any . and .. folders.
Type
String

<inner> renameProperty(obj, oldName, newName)

Renames a property in an object.
Parameters:
Name Type Description
obj Object Object in which the property will be renamed.
oldName String Name of the property that will be renamed.
newName String New name of the property. This function will not do anything if the object doesn't own a property with the specified old name.
Source:

<inner> throwErrorCallback(error)

Default error handler.
Parameters:
Name Type Description
error Object Error to handle.
Source:

<inner> trimString(str) → {String}

Removes leading and trailing whitespaces from a string.
Parameters:
Name Type Description
str String String to trim
Source:
Returns:
The string with no leading or trailing whitespace.
Type
String

<inner> undefinedDefault(value, defaultValue)

Returns a default value in place of undefined.
Parameters:
Name Type Argument Description
value <optional>
Value to check (may be null)
defaultValue Value to return if value is undefined.
Source:
Returns:
value if it's defined; defaultValue otherwise. This should only be used for cases where falsy values are valid; otherwise the pattern should be 'x = (value) ? value : defaultValue;'.