Normalize all injections into Object-based format
546198
function normalizeInject (options) {
  var inject = options.inject;
  if (Array.isArray(inject)) {
    var normalized = options.inject = {};
    for (var i = 0; i < inject.length; i++) {
      normalized[inject[i]] = inject[i];
    }
  }
}
1222142
function normalize(loader, mods) {
	var modNames = (mods && !Array.isArray(mods)) ? [mods] : mods;

	return (modNames || []).map(function(moduleName) {
		return !_.isString(moduleName) ?
			Promise.resolve(moduleName) :
			loader.normalize(moduleName);
	});
}
318514
function sanitize (data) {
  if (
    !isPrimitive(data) &&
    !Array.isArray(data) &&
    !isPlainObject(data)
  ) {
    // handle types that will probably cause issues in
    // the structured clone
    return Object.prototype.toString.call(data)
  } else {
    return data
  }
}
653975
def normalize_operations(self, operations):
        
        normalized = OrderedDict()

        for operation in operations:
            op_key = (operation.sql_type, operation.obj_name)

            # do we already have an operation for this object?
            if op_key in normalized:
                if self.verbosity >= 2:
                    self.stdout.write(" < %s" % normalized[op_key])

                del normalized[op_key]

            # don't add DROP operations for objects not previously created
            if operation.is_create:
                normalized[op_key] = operation
            elif self.verbosity >= 2:
                self.stdout.write(" < %s" % operation)

        return normalized.values()
437671
function normalizeParameters (data) {
  var encoded = []
  var normalized = ''

  // Convert object into nested arrays
  // and encode the keys and values.
  Object.keys(data).forEach(function (key) {
    encoded[encoded.length] = [
      encodeOAuthData(key),
      encodeOAuthData(data[key])
    ]
  })

  // Sort by keys and values
  encoded.sort(function (a, b) {
    return (a[0] === b[0])
      ? (a[1] < b[1])
        ? -1
        : 1
      : (a[0] < b[0])
        ? -1
        : 1
  })

  // Encode parameters similar to
  // query string.
  encoded.forEach(function (pair, i) {
    normalized += pair[0]
    normalized += '='
    normalized += pair[1]
    if (i < encoded.length - 1) {
      normalized += '&'
    }
  })

  // bada boom
  return normalized
}
681738
function Injector(obj){
  var services = {};
  var get = name => {
    if(!(name in services)){
      const err = new Error(`[injector] service "${name}" not found`);
      return Promise.reject(err);
    }
    return services[name];
  };
  if(typeof obj === 'object')
    services = obj;
  if(typeof obj === 'function')
    get = obj;
  function resolve(name) {
    let service = get(name);
    if(typeof service === 'function')
      service = invoke(service);
    return service;
  };
  function invoke(fn, that){
    return Promise
    .all(getParameterNames(fn).map(resolve))
    .then(params => fn.apply(that, params));
  }
  return invoke;
}
1200557
function normalizeFormat(format) {
  const clone = Object.assign({}, format);
  clone.prefix = normalizePrefixSuffix(format.prefix);
  clone.suffix = normalizePrefixSuffix(format.suffix);
  return clone;
}
6093
function normalize(pattern) {
        var type = toString.call(pattern);
        switch (type) {
            case '[object String]':
                return _.glob(pattern);
            case '[object RegExp]':
                return pattern;
            default:
                xgulp.log.error('invalid regexp [%s].', pattern);
        }
    }
318739
function normalizeAction(base, input) {
  assert(input.name, 'actions must have a name');
  assert(input.href, 'actions must have an href');

  var ret = clone(input);

  ret.href = normalizeHref(base, input.href);
  if (input.method) ret.method = normalizeMethod(input.method);

  var cls = normalizeClass(input.class);
  if (cls) ret.class = cls;

  var fields = normalizeFields(input.fields);
  if (fields) ret.fields = fields;

  return ret;
}
785213
function normalize(msg, list) {
  var lower = map(function(s) {
    return s.toLowerCase();
  }, list);
  var opts = msg.options || {};
  var integrations = opts.integrations || {};
  var providers = opts.providers || {};
  var context = opts.context || {};
  var ret = {};
  debug('<-', msg);

  // integrations.
  each(function(value, key) {
    if (!integration(key)) return;
    if (!has.call(integrations, key)) integrations[key] = value;
    delete opts[key];
  }, opts);

  // providers.
  delete opts.providers;
  each(function(value, key) {
    if (!integration(key)) return;
    if (type(integrations[key]) === 'object') return;
    if (has.call(integrations, key) && typeof providers[key] === 'boolean')
      return;
    integrations[key] = value;
  }, providers);

  // move all toplevel options to msg
  // and the rest to context.
  each(function(value, key) {
    if (includes(key, toplevel)) {
      ret[key] = opts[key];
    } else {
      context[key] = opts[key];
    }
  }, opts);

  // generate and attach a messageId to msg
  msg.messageId = 'ajs-' + md5(json.stringify(msg) + uuid());

  // cleanup
  delete msg.options;
  ret.integrations = integrations;
  ret.context = context;
  ret = defaults(ret, msg);
  debug('->', ret);
  return ret;

  function integration(name) {
    return !!(
      includes(name, list) ||
      name.toLowerCase() === 'all' ||
      includes(name.toLowerCase(), lower)
    );
  }
}
967548
function normalize(options, templates) {
  // Options override defaults and toc methods.
  var result = _.defaults({}, options, toc, toc.defaults);
  // Remove "core" methods from result object.
  ['defaults', 'process', 'anchorize', 'toc'].forEach(function(prop) {
    delete result[prop];
  });
  // Compile Lodash string templates into functions.
  (templates || []).forEach(function(tmpl) {
    if (typeof result[tmpl] === 'string') {
      result[tmpl] = _.template(result[tmpl]);
    }
  });
  return result;
}
762322
function normalizeRel(base, input) {
  if (!input) return;
  if (!Array.isArray(input)) input = [ input ];

  return flatten(input).map(function (rel) {
    return rel in iana ? rel : url.resolve(base, rel);
  });
}
1143814
function injectSubClasses (_object) {
  var object = _object
  for (var key in object) {
    if (~key.indexOf('__')) {
      var keySplit = key.split('__')
      var parentkey = keySplit[0]
      var newKey = keySplit.slice(1).join('__')

      object[parentkey] = object[parentkey] || {}
      object[parentkey][newKey] = object[key]

      if (~newKey.indexOf('__')) {
        // do it recursively
        object[parentkey] = injectSubClasses(object[parentkey])
      }

      delete object[key]
    }
  }
  return object
}
991743
def serialize_all(obj):
        """"""
        if '_hyperparameters' not in dir(obj):
            return {}
        return {k: str(v) for k, v in obj._hyperparameters.items() if v is not None}
1141725
function resolveDependencies( binds, obj ){
            let slotset =  context[ context.length-1 ];
            for( let key in injections ){
                if( binds && injections[key] in binds ){
                    obj[key] = binds[ injections[key] ];
                    continue;
                }
                
                let slot = slotset[ injections[key] ];
                let policy = slot.getViable( key, tags[key], multiple[key] );
                if( !multiple[key] )
                    obj[key] = policy([]);
                else{
                    let out = obj[key] = [];
                    for( let i=0; i<policy.length; ++i )
                        out[i] = policy[i]([]);
                }
            }
        }
88863
function normalizeMappings(mappings) {
        if (Array.isArray(mappings)) {
            return mappings.reduce(function (normalizedMappings, key) {
                normalizedMappings[key] = key;

                return normalizedMappings;
            }, {});
        }

        return mappings;
    }
1033940
function normalizeOptions(obj) {
  for (var key in obj) {
    if (utils.optsKeys.indexOf(key) > -1) {
      obj.options = obj.options || {};
      obj.options[key] = obj[key];
      delete obj[key];
    }
  }
  return obj;
}