Sha256: a5b7d2e2278e42cf081f214da4681ec947374964e102d0f2bf63cce91cd96d1e

Contents?: true

Size: 951 Bytes

Versions: 32

Compression:

Stored size: 951 Bytes

Contents

!(angular => {
  'use strict';

  class ParameterMethods {

    constructor() {
      this._parameterRegex = () => /\{\s*([^{}]+?)\s*}/g;
    }

    constructParameter(parameterName) {
      return { name: parameterName, type: 'raw' };
    }

    detectParameters(body, parameters) {
      let _this = this;
      let matches = body.match(this._parameterRegex());
      if (_.exists(matches)) {
        matches.forEach(match => {
          let parameterName = _this._parameterRegex().exec(match)[1];
          if(_this._parameterExists(parameters, parameterName)) {
            parameters.push(_this.constructParameter(parameterName));
          }
        });
      }
    }

    // private methods

    _parameterExists(parameters, parameterName) {
      return _.findIndex(parameters, p => p.name === parameterName) === -1;
    }
  }

  angular.module('alephServices.parameterMethods', []).service('ParameterMethods', ParameterMethods);
}(angular));

Version data entries

32 entries across 16 versions & 1 rubygems

Version Path
aleph_analytics-0.4.9.pre.dev public/assets/angular/services/lib/parameter_methods.js-16ecb25ffb24d5870dfc17f9f408fa5b.es6
aleph_analytics-0.4.9.pre.dev app/assets/javascripts/angular/services/lib/parameter_methods.js.es6
aleph_analytics-0.4.8 public/assets/angular/services/lib/parameter_methods.js-16ecb25ffb24d5870dfc17f9f408fa5b.es6
aleph_analytics-0.4.8 app/assets/javascripts/angular/services/lib/parameter_methods.js.es6
aleph_analytics-0.4.7 app/assets/javascripts/angular/services/lib/parameter_methods.js.es6
aleph_analytics-0.4.7 public/assets/angular/services/lib/parameter_methods.js-16ecb25ffb24d5870dfc17f9f408fa5b.es6
aleph_analytics-0.4.4 public/assets/angular/services/lib/parameter_methods.js-16ecb25ffb24d5870dfc17f9f408fa5b.es6
aleph_analytics-0.4.4 app/assets/javascripts/angular/services/lib/parameter_methods.js.es6
aleph_analytics-0.4.2 public/assets/angular/services/lib/parameter_methods.js-16ecb25ffb24d5870dfc17f9f408fa5b.es6
aleph_analytics-0.4.2 app/assets/javascripts/angular/services/lib/parameter_methods.js.es6
aleph_analytics-0.4.1 public/assets/angular/services/lib/parameter_methods.js-16ecb25ffb24d5870dfc17f9f408fa5b.es6
aleph_analytics-0.4.1 app/assets/javascripts/angular/services/lib/parameter_methods.js.es6
aleph_analytics-0.3.0 public/assets/angular/services/lib/parameter_methods.js-16ecb25ffb24d5870dfc17f9f408fa5b.es6
aleph_analytics-0.3.0 app/assets/javascripts/angular/services/lib/parameter_methods.js.es6
aleph_analytics-0.2.0 app/assets/javascripts/angular/services/lib/parameter_methods.js.es6
aleph_analytics-0.2.0 public/assets/angular/services/lib/parameter_methods.js-16ecb25ffb24d5870dfc17f9f408fa5b.es6
aleph_analytics-0.1.0 public/assets/angular/services/lib/parameter_methods.js-16ecb25ffb24d5870dfc17f9f408fa5b.es6
aleph_analytics-0.1.0 app/assets/javascripts/angular/services/lib/parameter_methods.js.es6
aleph_analytics-0.0.6 public/assets/angular/services/lib/parameter_methods.js-16ecb25ffb24d5870dfc17f9f408fa5b.es6
aleph_analytics-0.0.6 app/assets/javascripts/angular/services/lib/parameter_methods.js.es6