Reggino / communibase-template-data-factory

A collection of helper functions to simplify the use of Communibase data in Templates.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

communibase-template-data-factory

Enrich Communibase-data in any way possible for easy use in dynamic templates.

var Factory = require('communibase-template-data-factory');
// other deps

var factory = new Factory({ ... your options ...});
factory.getPromise("Person", person).then(function () { ... })

Constructor options

All options for the constructor are optional. Possible options:

cbc: an instance of the Communibase Connector. Will be spawned if not supplied stxt: a Javascript-object containing optional translations, e.g.:

{
    "Address.countryCode.NL": "Nederland",
    "Person.firstName": "Voornaam" 
 }

Extra serializers

Extra (custom) serializers can be added to the factory using the addSerializers-method. See serializers in the entityType-folder for examples and implementations

Debugging?

See runTest.js line 44, attach a debugger from the IDE to mocha

PLEASE NOTE

This library is compatible with Handlebars 2.0.0

Later versions of Handlebars have a different AST and do not function properly!

About

A collection of helper functions to simplify the use of Communibase data in Templates.

License:GNU General Public License v2.0


Languages

Language:JavaScript 95.4%Language:HTML 4.6%