Global

Members

# JSON

JSON parser.
License:
  • Public-Domain
See:

View Source DuESF.jsxinc, line 3602

# seedRandom

Adds a new Math.seedRandom() method, used as a workaround for a bug in Math.random() with After Effects on Mac OS
Author:
  • David Bau
License:
  • MIT

View Source DuESF.jsxinc, line 4427

Methods

# def(val, defaultVal) → {object}

Assigns a default value to a var if it's undefined.
Parameters:
Name Type Description
val object The variable to set
defaultVal object The default value

View Source DuESF.jsxinc, line 360

The var
object
Example
foo = def( foo, 12 ); // if foo was undefined, it is now 12, else it's unchanged.

# isdef(val) → {boolean}

Checks if a value is defined. Convenience replacement for `typeof val !== 'undefined`
Parameters:
Name Type Description
val any The value

View Source DuESF.jsxinc, line 371

boolean

# jstype(exp) → {string}

Improved typeof which returns the type of object instead of 'object'
Parameters:
Name Type Description
exp any The expression to check.

View Source DuESF.jsxinc, line 382

The type always in lower case.
string

# tr(str, context, args) → {string}

Translate a given string based on the current language
see DuTranslator for more details about the translation framework.
Parameters:
Name Type Description
str string The text to be translated
context int | string Can be an integer or a string which is related to contextId or context in a translation file
args Array.<string> Args to format into the translated string, default is []
For example, when calling tr("Welcome {#}", -1, "Paul"), the output will be "Welcome Paul"
If too many args are given, they're ignored
If not enough args are given, "{#}" is replaced with "?"

View Source DuESF.jsxinc, line 3537

The translated text or the original string if nothing is set or available
string