Global

Methods

debase(name) → {function|Debaser}

Shortcut to the debase method of the default Debaser instance.

Convenience method. Retrieves the default Debaser instance (whatever that may be) and runs its debase() method.

Parameters:
Name Type Argument Description
name string <optional>

Name of Debaser instance to call Debaser#debase upon.

Returns:
Type
function | Debaser
Example
before(function() {
  debaser()
    .func('foo')
    .object('bar')
});

beforeEach(debase);

// above equivalent to:

var d;
before(function() {
  d = debaser()
    .func('foo')
    .object('bar')
});

beforeEach(function() {
  d.debase();
});

debaser(name, options) → {Debaser}

Provides a Debaser object with which you can stub dependencies easily.

The object by this method exposes actions, which are chainable. Each action "queues up" something to be stubbed, be that a module, function, object, or whatever. When you have queued all your actions, execute debase() and the stubs will be provided.

Parameters:
Name Type Argument Default Description
name String | Object <optional>
DebaserOptions.name

Optional name of Debaser. Only useful if using multiple instances. If omitted, this is considered the opts parameter.

options DebaserOptions <optional>
{}

Options to modify angular-debaser's behavior; see DebaserOptions.

Tutorials:
Returns:
Type
Debaser
Example
// Defaults
var d = debaser({
 debugEnabled: false,
 autoScope: true
 skipConfigs: true
});

// Named
var d = debaser('foo', {
 debugEnabled: false,
 autoScope: true
 skipConfigs: true
});

Type Definitions

Action()

A method (on a Debaser instance) which tells angular-debaser to provide some object, method, function, etc.

These functions will always return Debaser instances, however, the mixins used will change. The "root" mixin is the base mixin. All other mixins "inherit" from this one, meaning the base methods will always be available.

Example
debaser
  .object('Foo') // we are now in the `base.object` mixin.
  .withFunc('bar') // we are now in the `base.withFunc` mixin.
  // however, since these mixins are inherited, we always have access to 
  // method `object`, which is on the `base` mixin.
  .object('Baz')
  .debase(); // go!
  // `Foo` and `Baz` are now injectable; `Foo` has a static function `bar`
  

DebaserOptions

Options, and their defaults, which you can pass into window.debaser().

Default options

Type:
  • Object
Properties:
Name Type Argument Default Description
debugEnabled boolean <optional>
false

Enable debug log messages?

autoScope boolean <optional>
true

Enable auto-scope functionality when using ng.$controller?

skipConfigs boolean <optional>
true

Enable stubbing of config() blocks?

defaultName string <optional>
__default__

Default name of default Debaser instance; useless