wraps value to be piped with lodash #chain method returns String a -> String b
166453
function(line, index, lines) {
        var hasPipe = /^\s*\|\>/;
        var nextLine = lines[index + 1] || '';

        if (line.match(hasPipe)|| !nextLine.match(hasPipe)) {
          return line;
        }
        // handle wrapping returned values
        else if (line.match(/^\s*return/)) { // starts with return
          return line.replace(/^return (.+)/, function($0, $1) {
              return 'return _.chain(' + $1 +')';
          });
        }
        // handle wrapping assignments eg, foo = [1, 2, 3]
        else if (line.match(/^\s*[\w$]+\s+\=\s+/)) { // starts with `foo =`
          return line.replace(/(^\s*[\w$]+\s+\=\s+)(.+)/, function($0, $1, $2) {
              return $1 + '_.chain(' + $2 +')';
          });
        }
        else if (!!line.trim()) {
          return '_.chain(' + line + ')';
        }
        else {
          return line;
        }
    }
428772
def _wrap(self, ret):
        
        if self.chained:
            self._wrapped = ret
            return self
        else:
            return ret
167258
function getGraphQLValue(value) {
      if ("string" === typeof value) {
        value = JSON.stringify(value);
      } else if (Array.isArray(value)) {
        value = value.map(item => {
            return getGraphQLValue(item);
            }).join();
        value = `[${value}]`;
      } else if ("object" === typeof value) {
      /*if (value.toSource)
            value = value.toSource().slice(2,-2);
        else*/
            value = objectToString(value);
            //console.error("No toSource!!",value);
      }
      return value;
}
1227918
function outboundPayload( pipe ){
	//Clone first
	var result = JSON.parse(JSON.stringify( pipe ) );
	if ( result.hasOwnProperty("tables")){
		//Filtered down the table object as the info it contains is too big to be transported back and forth
		result.tables = _.map( result.tables, function( table ){
			var ret = { name: table.name, label: table.label, labelPlural: table.labelPlural };
			//Check for field that start with prefix CLIENT_ which means that the connector expects the value to be sent to client
			_.map(table, function(value, key){
				if ( _.startsWith(key, "CLIENT_")){
					ret[key] = value;
				}
			});
			return ret;
		});
	}
	
	if ( result.hasOwnProperty( "sf") ){
		delete result.sf;
	}
	return result;
}
1064068
def wrap_as_stream(item):
    
    if not PY3:
        return StringIO(item)
    if isinstance(item, str):
        return StringIO(item)
    elif isinstance(item, bytes):
        return BytesIO(item)
    raise ValueError('{} is not wrappable!'.format(type(item).__name__))
438885
function deep_set(root, path, value) {
    var twig = root;
    path.split('/').forEach(function (branch, index, branches) {
        if (branch) {
            if (self.camelize) {
                branch = branch.replace(/(\-([a-z]))/g, function (m) { return m[1].toUpperCase(); })
            }
            if (index < branches.length - 1) {
                twig = twig[branch] || (twig[branch] = {});
            } else {
                // optimistically try treating the value as JSON
                try {
                    twig[branch] = JSON.parse(value);
                } catch (e) {
                    twig[branch] = value;
                }
            }
        }
    });
}
56743
function valuesToStrings(payload) {
	var stringifiedPayload = {};
	for (var key in payload) {
		if (payload.hasOwnProperty(key)) {
			stringifiedPayload[key] = payload[key].toString();
		}
	}
	return stringifiedPayload;
}
859092
function packValue(value) {
            const result = memoizedMap.get(value);
            if (result == null) {
                if (value >= MIN_DICT_INDEX && value <= MAX_VERBATIM_INTEGER && Number.isInteger(value))
                    return -value;
                
                memoize(value);
                
                if (typeof value === "number")
                    return String(value);
                if (/^[0-9\.]|^~/.test(value))
                    return `~${value}`;
                return value;
            }
            return result;
        }
367249
function s () {
  var args = arrayFrom(arguments)
  var msg = args.shift()
  return args.reduce(replace(/(?:%s|%d)/), '[pipeP] ' + msg)
}
1328340
function arrayToStr(key, value) {
  if (isString(value) || isNumber(value)) return `${key}=${value}`;
  if (isString(value[0])) return `${key}=${value.join(':')}`;
  if (value && value.toString) return `${key}=${value.toString()}`;

  return value.map(val => arrayToStr(key, val));
}
1045584
function stringifyReplacerArr (key, value, stack, replacer) {
  var i, res
  // If the value has a toJSON method, call it to obtain a replacement value.
  if (typeof value === 'object' && value !== null && typeof value.toJSON === 'function') {
    value = value.toJSON(key)
  }

  switch (typeof value) {
    case 'object':
      if (value === null) {
        return 'null'
      }
      for (i = 0; i < stack.length; i++) {
        if (stack[i] === value) {
          return '"[Circular]"'
        }
      }
      if (Array.isArray(value)) {
        if (value.length === 0) {
          return '[]'
        }
        stack.push(value)
        res = '['
        // Use null as placeholder for non-JSON values.
        for (i = 0; i < value.length - 1; i++) {
          const tmp = stringifyReplacerArr(i, value[i], stack, replacer)
          res += tmp !== undefined ? tmp : 'null'
          res += ','
        }
        const tmp = stringifyReplacerArr(i, value[i], stack, replacer)
        res += tmp !== undefined ? tmp : 'null'
        res += ']'
        stack.pop()
        return res
      }

      if (replacer.length === 0) {
        return '{}'
      }
      stack.push(value)
      res = '{'
      var separator = ''
      for (i = 0; i < replacer.length; i++) {
        if (typeof replacer[i] === 'string' || typeof replacer[i] === 'number') {
          key = replacer[i]
          const tmp = stringifyReplacerArr(key, value[key], stack, replacer)
          if (tmp !== undefined) {
            res += `${separator}"${strEscape(key)}":${tmp}`
            separator = ','
          }
        }
      }
      res += '}'
      stack.pop()
      return res
    case 'string':
      return `"${strEscape(value)}"`
    case 'number':
      // JSON numbers must be finite. Encode non-finite numbers as null.
      return isFinite(value) ? String(value) : 'null'
    case 'boolean':
      return value === true ? 'true' : 'false'
  }
}
276767
function(line, index, lines) {
        var newLine;
        if (insideString('|>', line)) return line;
        // line does not have a one liner pipeline
        if (!line.match(/(\=|return)(.*?)(\|\>)/)) return line;
        // if next line has a pipe operator
        if (lines[index] && lines[index + 1].match(/^\s*\|\>/)) return line;

        // http://rubular.com/r/wiBJtf12Vn
        // (^.+?)     $1 value to pipe
        // \s*        optional spaces
        // (\|\>)     $2 |> pipe operator
        // (.*?)$     $3 tail minus first pipe ($2)
        //
        var parts = line.match(/(^.+?)\s*(\|\>)(.*?)$/);
        var head = parts[1]
        var tail = parts[2].concat(parts[3]);

        // process head depending on if it's immuttable or not
        if (head.match('Immutable')) {
            head = head.replace('Immutable', '_.chain(Immutable');
        }
        else if (head.match(/^\s*return/)) {
            head = head.replace('return ', 'return _.chain(');
        }
        else if (head.match(/\s=\s/)) {
            head = head.replace('= ', '= _.chain(');
        }

        tail = tail.replace(/(\s*\|\>\s*)/g, function($0, $1) {
            return ').pipesCall(';
        })

        return head + tail + ').value();'
    }
73964
function wrapValues (values, objtypes) {
  var result = [];
  for(var i=0; i < objtypes.length; i++) result.push(wrapValue(values[i], objtypes[i]));
  return result;
}
1130008
function (item, field) {
            var path = field.split("."), value = item;
            while (path.length && typeof(value) !== "undefined") {
                value = value[path.shift()];
            }
            return value;
        }
243197
function stringDotToObj(result, prop, name, value) {
        if (!result[prop]) {
            result[prop] = {};
        }
        name = name.substring((prop + '.').length, name.length);
        result[prop][name] = value;
    }
711035
function _wrapString(value) {
    var segments,
        asIndex = value.toLowerCase().indexOf(' as ');
    if (asIndex !== -1) {
      var first = value.slice(0, asIndex);
      var second = value.slice(asIndex + 4);
      return this.alias(this.wrap(first), this.wrap(second));
    }
    var i = -1,
        wrapped = [];
    segments = value.split('.');
    while (++i < segments.length) {
      value = segments[i];
      if (i === 0 && segments.length > 1) {
        wrapped.push(this.wrap((value || '').trim()));
      } else {
        wrapped.push(this.client.wrapIdentifier((value || '').trim()));
      }
    }
    return wrapped.join('.');
  }
885172
function clone(source, deep) {
    if (deep) {
        return lodash.cloneDeep(source);
    } else {
        return lodash.clone(source);
    }
}