How to use formio-workers - 5 common examples

To help you get started, we’ve selected a few formio-workers examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github formio / formio / test / unit.js View on Github external
it('Should render a string with tokens', function(done) {
      new Thread(Thread.Tasks.nunjucks).start({
        render: '{{ data.firstName }} {{ data.lastName }}',
        context: {
          data: {
            firstName: 'Travis',
            lastName: 'Tidwell'
          }
        },
        filters: {
          test: function(string, param) {
            var retVal = this.env.params.form + ' : ' + string;
            if (param) {
              retVal += ' : ' + param;
            }
            return retVal;
          }
        }
github formio / formio / test / unit.js View on Github external
it('Should not expose private context variables.', function(done) {
      new Thread(Thread.Tasks.nunjucks).start({
        render: '{{ _private.secret }}',
        context: {
          _private: {
            secret: '5678'
          },
          form: '123',
          data: {
            firstName: 'Travis',
            lastName: 'Tidwell'
          }
        },
        filters: {
          test: function(string, param) {
            var retVal = this.env.params.form + ' : ' + string;
            if (param) {
              retVal += ' : ' + param;
github formio / formio / src / util / util.js View on Github external
*   The Express request object.
   * @param key
   *   The key to search for in the headers.
   *
   * @return
   *   The header value if found or false.
   */
  getHeader(req, key) {
    if (typeof req.headers[key] !== 'undefined') {
      return req.headers[key];
    }

    return false;
  },

  flattenComponentsForRender: workerUtils.flattenComponentsForRender.bind(workerUtils),
  renderFormSubmission: workerUtils.renderFormSubmission.bind(workerUtils),
  renderComponentValue: workerUtils.renderComponentValue.bind(workerUtils),

  /**
   * Search the request query for the given key.
   *
   * @param req
   *   The Express request object.
   * @param key
   *   The key to search for in the query.
   *
   * @return
   *   The query value if found or false.
   */
  getQuery(req, key) {
    if (typeof req.query[key] !== 'undefined') {
github formio / formio / src / util / util.js View on Github external
*   The key to search for in the headers.
   *
   * @return
   *   The header value if found or false.
   */
  getHeader(req, key) {
    if (typeof req.headers[key] !== 'undefined') {
      return req.headers[key];
    }

    return false;
  },

  flattenComponentsForRender: workerUtils.flattenComponentsForRender.bind(workerUtils),
  renderFormSubmission: workerUtils.renderFormSubmission.bind(workerUtils),
  renderComponentValue: workerUtils.renderComponentValue.bind(workerUtils),

  /**
   * Search the request query for the given key.
   *
   * @param req
   *   The Express request object.
   * @param key
   *   The key to search for in the query.
   *
   * @return
   *   The query value if found or false.
   */
  getQuery(req, key) {
    if (typeof req.query[key] !== 'undefined') {
      return req.query[key];
    }
github formio / formio / src / util / util.js View on Github external
* @param key
   *   The key to search for in the headers.
   *
   * @return
   *   The header value if found or false.
   */
  getHeader(req, key) {
    if (typeof req.headers[key] !== 'undefined') {
      return req.headers[key];
    }

    return false;
  },

  flattenComponentsForRender: workerUtils.flattenComponentsForRender.bind(workerUtils),
  renderFormSubmission: workerUtils.renderFormSubmission.bind(workerUtils),
  renderComponentValue: workerUtils.renderComponentValue.bind(workerUtils),

  /**
   * Search the request query for the given key.
   *
   * @param req
   *   The Express request object.
   * @param key
   *   The key to search for in the query.
   *
   * @return
   *   The query value if found or false.
   */
  getQuery(req, key) {
    if (typeof req.query[key] !== 'undefined') {
      return req.query[key];

formio-workers

A Nunjucks rendering template service for Form.io forms.

MIT
Latest version published 1 month ago

Package Health Score

68 / 100
Full package analysis

Similar packages