Jump To …

twig.module.js

Twig.js
Copyright (c) 2011-2012 John Roepke
Available under the BSD 2-Clause License
https://github.com/justjohn/twig.js

twig.module.js

Provide a CommonJS module export.

if (typeof module !== 'undefined' && module.declare) {

Provide a CommonJS Modules/2.0 draft 8 module

    module.declare([], function(require, exports, module) {

Add exports from the Twig exports

        for (key in Twig.exports) {
            if (Twig.exports.hasOwnProperty(key)) {
                exports[key] = Twig.exports[key];
            }   
        }
    });
} else if (typeof module !== 'undefined' && module.exports) {

Provide a CommonJS Modules/1.1 module

    module.exports = Twig.exports;
} else {

Export for browser use

    window.twig = Twig.exports.twig;
    window.Twig = Twig.exports;
}