demux an object into server params and pass them into a function (obj, fn) -> null
10768
function demuxSsa (params, cb) {
  assert.equal(typeof params, 'object')
  assert.equal(typeof params._ssa, 'object')
  assert.equal(typeof cb, 'function')
  const req = params._ssa.req
  const res = params._ssa.res
  const nw = xtend(params)
  delete nw._ssa
  cb(req, res, nw)
}
345527
function wrapObject(obj, path, prefix) {
  const keys = Object.keys(obj);
  const ret = {};
  for (const key of keys) {
    if (is.function(obj[key])) {
      const names = utility.getParamNames(obj[key]);
      if (names[0] === 'next') {
        throw new Error(`controller \`${prefix || ''}${key}\` should not use next as argument from file ${path}`);
      }
      ret[key] = functionToMiddleware(obj[key]);
      ret[key][FULLPATH] = `${path}#${prefix || ''}${key}()`;
    } else if (is.object(obj[key])) {
      ret[key] = wrapObject(obj[key], path, `${prefix || ''}${key}.`);
    }
  }
  return ret;

  function functionToMiddleware(func) {
    const objectControllerMiddleware = async function(...args) {
      if (!this.app.config.controller || !this.app.config.controller.supportParams) {
        args = [ this ];
      }
      return await utils.callFn(func, args, this);
    };
    for (const key in func) {
      objectControllerMiddleware[key] = func[key];
    }
    return objectControllerMiddleware;
  }
}
1345626
function initParams(uri, options, callback) {
      if (typeof options === 'function') {
        callback = options
      }

      var params = {}
      if (typeof options === 'object') {
        extend(params, options, { uri: uri })
      } else if (typeof uri === 'string') {
        extend(params, { uri: uri })
      } else {
        extend(params, uri)
      }

      params.callback = callback
      return params
    }
347832
function(str, opt_obj) {
    var dst = opt_obj || {};
    try {
      var q = str.indexOf("?");
      var e = str.indexOf("#");
      if (e < 0) {
        e = str.length;
      }
      var query = str.substring(q + 1, e);
      searchStringToObject(query, dst);
    } catch (e) {
      console.error(e);
    }
    return dst;
  }
835606
function(objName, fnName, func) {
    if ("production" !== "development") {
      var measuredFunc = null;
      var wrapper = function() {
        if (ReactPerf.enableMeasure) {
          if (!measuredFunc) {
            measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
          }
          return measuredFunc.apply(this, arguments);
        }
        return func.apply(this, arguments);
      };
      wrapper.displayName = objName + '_' + fnName;
      return wrapper;
    }
    return func;
  }
1059218
function getParams(obj) {
    var defs = []

    for (var name in obj) {
      var data = obj[name]
        , fromPath = ~required.indexOf(name)

      // If string, assume a single data type
      if (typeof data === 'string') {
        data = data.split(',')
      }

      // If array, assume array of data types
      if (Array.isArray(data)) {
        data = obj[name] = {
          dataTypes: data
        }
      }

      // Check for singular spelling
      if (data.dataType) {
        data.dataTypes = data.dataType
      }

      // Ensure datatypes is an array
      if (!Array.isArray(data.dataTypes)) {
        data.dataTypes = [data.dataTypes]
      }

      // Normalize data types
      var types = _.uniq((data.dataTypes || []).map(function(type) {
        return type && type.toLowerCase()
      }))

      // Parameter type / source
      var paramType = 'path'
      if (!fromPath) {
        // If not a URI param, check to see if a `post` source
        // was specified, otherwise default to `querystring`
        paramType = (data.paramType && data.paramType === 'post')
          ? 'post'
          : 'querystring'
      }

      // Parameter spec information
      var param = {
        name: name
      , required: fromPath ? true : !!data.required
      , paramType: paramType
      , dataTypes: types
      }

      // If we have a number, check if a min / max value was set
      if (~types.indexOf('number')) {
        if (_.has(data, 'min')) param.min = +data.min;
        if (_.has(data, 'max')) param.max = +data.max;
      }

      // Add in any extra information defined from options
      if (self.options.paramProperties) {
        self.options.paramProperties.forEach(function(prop) {
          if (_.has(data, prop)) {
            param[prop] = data[prop]
          }
        })
      }

      // If we have an object type, check for sub-schemas
      if (~types.indexOf('object') && data.params) {
        param.params = getParams(data.params)
      }

      defs.push(param)
    }
    return defs
  }
214774
function foo(obj){
    let fn = obj.fn;
    let err = obj.err;
    return next => Sink.of(
        (value, time, scheduler, task) => fn(value, time, next, scheduler, task),
        (e, time, scheduler, task) => err(e, time, next, scheduler, task));
}
532063
function (obj) {
        var str = ['{'];
        for (var key in obj) {
            if (!_.isUndefined(key)) {
                if (!_.isFunction(obj[key])) {
                    str.push(key + ':');
                    str.push(_.isUndefined(obj[key]) ? '""' : '"' + obj[key] + '"');
                    str.push(', ');
                }
            }
        }
        str.pop();
        str.push('}');
        return str.join('');
    }
855374
function mapObject(obj, fn) {
  if (typeof obj !== 'object') {
    throw new Error('Expected an object as the first argument');
  }

  if (typeof fn !== 'function') {
    throw new Error('Expected second argument to be a function');
  }

  const keys = Object.keys(obj);
  const mappedObj = {};
  for (const key of keys) {
    mappedObj[key] = fn(obj[key], key);
  }
  return mappedObj;
}
53972
function(obj, callback, error) {
      var that = this
      objs = (this.isArray(obj) ? obj : [obj]).map(function(o) {
        if (!o.key) {
          o.key = that.uuid()
        }
        return o
      }),
        ins = "INSERT OR REPLACE INTO " + this.record + " (value, timestamp, id) VALUES (?,?,?)",
        win = function() {
          if (callback) {
            that.lambda(callback).call(that, that.isArray(obj) ? objs : objs[0])
          }
        }, error = error || function() {}, insvals = [],
        ts = now()

        try {
          for (var i = 0, l = objs.length; i < l; i++) {
            insvals[i] = [JSON.stringify(objs[i]), ts, objs[i].key];
          }
        } catch (e) {
          fail(e)
          throw e;
        }

      that.db.transaction(function(t) {
        for (var i = 0, l = objs.length; i < l; i++)
          t.executeSql(ins, insvals[i])
      }, function(e, i) {
        fail(e, i)
      }, win)

      return this
    }
430018
function print(object) {
    console.log(util.inspect(object, null, null, true));
}
766724
function (obj, fn) {
        for (var i in obj) {
            if (typeof obj[i] === 'object') {
                obj[i] = parse(obj[i], fn);
            } else {
                obj[i] = fn(obj[i], i);
            }
        }
        return obj;
    }
624500
private void pullDestructuringOutOfParams(Node paramList, Node function) {
    Node insertSpot = null;
    Node body = function.getLastChild();
    int i = 0;
    Node next = null;
    for (Node param = paramList.getFirstChild(); param != null; param = next, i++) {
      next = param.getNext();
      if (param.isDefaultValue()) {
        Node nameOrPattern = param.removeFirstChild();
        // We'll be cloning nameOrPattern below, and we don't want to clone the JSDoc info with it
        JSDocInfo jsDoc = nameOrPattern.getJSDocInfo();
        nameOrPattern.setJSDocInfo(null);
        Node defaultValue = param.removeFirstChild();
        Node newParam;

        // Treat name=undefined (and equivalent) as if it was just name.  There
        // is no need to generate a (name===void 0?void 0:name) statement for
        // such arguments.
        boolean isNoop = false;
        if (!nameOrPattern.isName()) {
          // Do not try to optimize unless nameOrPattern is a simple name.
        } else if (defaultValue.isName()) {
          isNoop = "undefined".equals(defaultValue.getString());
        } else if (defaultValue.isVoid()) {
          // Any kind of 'void literal' is fine, but 'void fun()' or anything
          // else with side effects isn't.  We're not trying to be particularly
          // smart here and treat 'void {}' for example as if it could cause side effects.
          isNoop = NodeUtil.isImmutableValue(defaultValue.getFirstChild());
        }

        if (isNoop) {
          newParam = nameOrPattern.cloneTree();
        } else {
          newParam =
              nameOrPattern.isName()
                  ? nameOrPattern
                  : astFactory.createName(getTempVariableName(), nameOrPattern.getJSType());
          Node lhs = nameOrPattern.cloneTree();
          Node rhs = defaultValueHook(newParam.cloneTree(), defaultValue);
          Node newStatement =
              nameOrPattern.isName()
                  ? IR.exprResult(astFactory.createAssign(lhs, rhs))
                  : IR.var(lhs, rhs);
          newStatement.useSourceInfoIfMissingFromForTree(param);
          body.addChildAfter(newStatement, insertSpot);
          insertSpot = newStatement;
        }

        paramList.replaceChild(param, newParam);
        newParam.setOptionalArg(true);
        newParam.setJSDocInfo(jsDoc);

        compiler.reportChangeToChangeScope(function);
      } else if (param.isDestructuringPattern()) {
        insertSpot =
            replacePatternParamWithTempVar(function, insertSpot, param, getTempVariableName());
        compiler.reportChangeToChangeScope(function);
      } else if (param.isRest() && param.getFirstChild().isDestructuringPattern()) {
        insertSpot =
            replacePatternParamWithTempVar(
                function, insertSpot, param.getFirstChild(), getTempVariableName());
        compiler.reportChangeToChangeScope(function);
      }
    }
  }
24110
function toQueryParams(object){
	return Object.keys(object)
		.filter(key => !!object[key])
		.map(key => key + "=" + encodeURIComponent(object[key]))
		.join("&")
}
692030
function (obj /*, arguments */) {
    var stack = [obj];
    var leaf = true;
    for (var i = 1; i < arguments.length - 1; i++) {
      var key = arguments[i];
      if (!(key in obj)) {
        leaf = false;
        break;
      }
      obj = obj[key];
      if (typeof obj !== "object")
        break;
      stack.push(obj);
    }

    for (var i = stack.length - 1; i >= 0; i--) {
      var key = arguments[i+1];

      if (leaf)
        leaf = false;
      else
        for (var other in stack[i][key])
          return; // not empty -- we're done

      delete stack[i][key];
    }
  }
284186
def listen(obj, name, func):
    
    signals = vars(obj).setdefault('_signals', {})
    signals.setdefault(name, []).append(func)
105231
function obMerge(prefix, ob1, ob2 /*, ...*/)
    {
        for (var i=2; i<arguments.length; ++i)
        {
            for (var nm in arguments[i]) 
            {
                if (arguments[i].hasOwnProperty(nm) || typeof arguments[i][nm] == 'function')
                {
                    if (typeof(arguments[i][nm]) == 'object' && arguments[i][nm] != null)
                    {
                        ob1[prefix+nm] = (arguments[i][nm] instanceof Array) ? new Array : new Object;
                        obMerge('', ob1[prefix+nm], arguments[i][nm]);
                    }
                    else
                    {
                        ob1[prefix+nm] = arguments[i][nm]; 
                    }
                }
            }
        }
        return ob1;
    }