Sha256: 1224464f895391a079f628fad9494c1ca4c032e67081ddba464197678556639e

Contents?: true

Size: 714 Bytes

Versions: 4

Compression:

Stored size: 714 Bytes

Contents

app.factory('normalizeAttributes', function() {
  function normalize(type, attributes, parent) {
    _.forEach(attributes, function(attribute, name) {
      var path = parent.concat([name]);
      if (!attribute.options) attribute.options = {};
      if (attribute.values != null) attribute.options.values = attribute.values;
      if (attribute.default != null) attribute.options.default = attribute.default;
      if (attribute.example != null) attribute.options.example = attribute.example;
      if (attribute.type && attribute.type.attributes) {
        normalize(type, attribute.type.attributes, path);
      }
    });
  }

  return function(type, attributes) {
    normalize(type, attributes, []);
  };
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
praxis-0.21 lib/api_browser/app/js/factories/normalize_attributes.js
praxis-0.20.1 lib/api_browser/app/js/factories/normalize_attributes.js
praxis-0.20.0 lib/api_browser/app/js/factories/normalize_attributes.js
praxis-0.19.0 lib/api_browser/app/js/factories/normalize_attributes.js