Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
joo.classLoader.prepare("package net.jangaroo.ext",/* {*/

"public class Exml",1,function($$private){return[ 

  "public static const",{ PREPEND/*:int*/ : -1},
  "public static const",{ APPEND/*:int*/ : 0},

  "private static const",{ AT/*:String*/ :"$at"},

  /**
   * Merge override config object into the given config object.
   * This function is mainly used by code generated from EXML source files.
   */
  "public static function apply",function apply(config/*:Object*/, overrideConfig/*:Object*/)/*:Object*/ {
    for (var property/*:String*/ in overrideConfig) {
      if (property.substr(property.length - $$private.AT.length) !== $$private.AT) {
        $$private.applyProperty(config, overrideConfig, property);
      }
    }
    return config;
  },

  "private static function applyProperty",function applyProperty(config/*:Object*/, overrideConfig/*:Object*/, property/*:String*/)/*:void*/ {
    var overrideValue/*:**/ = overrideConfig[property];
    if (overrideValue === undefined) {
      // completely ignore properties with a value of "undefined":
      return;
    }
    var atProperty/*:String*/ = property + $$private.AT;
    var overrideAt/*:int*/ = overrideConfig[atProperty];
    if (overrideAt === undefined) {
      // If the override does not provide an at position,
      // make sure to forget about the at position of the original config, too.
      delete config[atProperty];
    } else {
      var value/*:**/ = config[property];
      var at/*:int*/ = config[atProperty];
      if (value === undefined && at === undefined) {
        // If the original config does not mention the property,
        // pass the at position along with the value.
        config[atProperty] = overrideAt;
      } else {
        var overrideValueArray/*:Array*/ = $$private.toArray(overrideValue);
        if (overrideAt === net.jangaroo.ext.Exml.PREPEND) {
          overrideAt = overrideValueArray.length;
        }
        var valueArray/*:Array*/ = $$private.toArray(value);
        if (at !== undefined) {
          if (at === net.jangaroo.ext.Exml.PREPEND) {
            at = valueArray.length;
          }
          config[atProperty] = at + overrideAt;
        }
        overrideValue = overrideValueArray.slice(0, overrideAt).concat(valueArray, overrideValueArray.slice(overrideAt));
      }
    }
    config[property] = overrideValue;
  },

  "private static const",{ EMPTY_ARRAY/*:Array*/ :function(){return( []);}},

  "private static function toArray",function toArray(value/*:**/)/*:Array*/ {
    return value === undefined ? $$private.EMPTY_ARRAY : value instanceof Array ? value : [value];
  },

undefined];},["apply"],["Array"], "0.8.0", "2.0.11"
);
New to GrepCode? Check out our FAQ X