0.1.0 • Published 9 years ago

nomade-core v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

Nomade core Build Status

An extension containing core services.

Quick start

// registers extension
kernel.register(require('nomade-core'));

Common usage

All services provided by the core extension are based on the adapter pattern.

  • To always use a specific adapter:

    config = {
        'service-id': {
            adapter: 'adapter-id'
        }
    };
  • To route to an adapter using a function:

    config = {
        'service-id': {
            adapter: function (/* adapter specific parameters */) {
                // your logic here
                return 'adapter-id';
            }
        }
    };
  • If you don't specify any adapter, the default one will be used.

  • If you don't define any config for a service, a special noop adapter will be used.
  • If you specify a non existing adapter, the noop one will be used.

Provided services

  • translator: Translates string
    • trans(message, [locale], [params]): returns a string
    • choose(message, count, [locale], [params]): returns a string