Fork me on GitHub
Show:

util

Defined in: ../src/util.js:19

static

Summary

Aeris library utilities.

Methods

abstractMethod

Defined in ../src/util.js:26

Syntax

abstractMethod

()

Summary

Representation of an abstract method that needs overriding.

argsToArray

Defined in ../src/util.js:151

Syntax

argsToArray

(
  • args
)
Array

Summary

Converts an arguments object to a true array.

Parameters:

Returns:

average

Defined in ../src/util.js:112

Syntax

average

(
  • arr
)

Summary

Returns the average of an array of numbers.

Parameters:

expose

Defined in ../src/util.js:69

Syntax

expose

(
  • obj
  • path
)

Summary

Expose a variable at the provided path under the global namespace.

Eg. _.expose(MyClass, 'aeris.someSubNs.MyClass'); aeris.someSubNs.MyClass === MyClass // true

Parameters:

  • obj *

    The variable to expose.

  • path String

    Path that should be available.

inherits

Defined in ../src/util.js:51

Syntax

inherits

(
  • ChildCtor
  • ParentCtor
)

Summary

Inherit the prototype methods from one constructor into another.

Parameters:

interval

Defined in ../src/util.js:129

Syntax

interval

(
  • fn
  • wait
  • opt_ctx
  • var_args
)
Number

Summary

Similar to window.setInterval, but allows for an optional context and arguments to be passed to the function.

Parameters:

Returns:

Number:

Reference to the interval, to be used with clearInterval.

isInteger

Defined in ../src/util.js:228

Syntax

isInteger

(
  • n
)
Boolean

Summary

Parameters:

Returns:

isNumeric

Defined in ../src/util.js:207

Syntax

isNumeric

(
  • obj
)
Boolean

Summary

A loose test for number-like objects.

.isNumeric(123) // true .isNumeric('123') // true .isNumeric('foo') // false .isNumeric('10px') // false _.isNumberic(''); // false

Thanks to this guy: http://stackoverflow.com/a/1830844

Parameters:

  • obj *

Returns:

path

Defined in ../src/util.js:163

Syntax

path

(
  • pathStr
  • opt_scope
)
*|undefined

Summary

Return a reference to a object property from a dot-notated string.

For example var obj = { foo: bar: { baz: 'in here!' } } } _.path('foo.bar.baz') // 'in here!'

Returns undefined if no reference exists.

eg: _.path('foo.boo.goo.moo.yoo') // undefined

This can be useful for attempting to access object properties, when you're not sure if the entire object is defined.

Parameters:

  • pathStr String
  • opt_scope Object=

    The object within which to search for a reference. If no scope is defined, will search within the global scope (window).

Returns:

provide

Defined in ../src/util.js:100

Syntax

provide

(
  • path
)
Undefined

Summary

Ensures the defined path is available base on dot namespace.

Parameters:

  • path String

    Path that should be available.

Returns:

throwUncatchable

Defined in ../src/util.js:244

Syntax

throwUncatchable

(
  • e
)

Summary

Throw an 'uncatchable' error.

The error is 'uncatchable' because it is thrown after the current call stack completes. This is generally a bad idea, though it can be useful for forcing errors to be thrown in promise callbacks.

Parameters:

tryCatch

Defined in ../src/util.js:310

Syntax

tryCatch

(
  • tryFn
  • catchFn
)

Summary

Parameters: