convert string to closure
760121
private static function str2closure($controllerAction)
    {
        list($controller, $action) = explode('@', $controllerAction);
        return function($request) use ($controller, $action) {
            $c = new $controller;
            return call_user_func([$c, $action], $request);
        };
    }
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('.');
  }
610306
function toArrayOrUndefined(str) {
    if (validation.isArray(str) && str.length < 1) {
        return undefined;
    }

    try {
        let parsedArray = str;

        if (typeof str !== 'object') {
            parsedArray = JSON.parse(str);
        }

        if (validation.isArray(parsedArray) && parsedArray.length > 0) {
            return parsedArray;
        }
        else {
            return undefined;
        }
    }
    catch (e) {
        return undefined;
    }
}
661048
def wrap(start: str, string: str, end: str = "") -> str:
    
    return f"{start}{string}{end}" if string else ""
255467
function parseCover(str) {
    str = str.split(EOL);
    var obj = {};
    var reg = /(\w+)\s?:\s?(.+)/;
    str.forEach(function(val) {
        if (val = reg.exec(val)) {
            obj[val[1]] = val[2];
        }
    });
    return obj;
}
797725
function parse(str, options, callback) {
	if (typeof options === 'function') {
		callback = options
		options = {}
	}
	process.nextTick(() => {
		const output = parseSync(str, options)
		callback(output)
	})
}
1242123
function toFn (value) {
  if (typeof value === 'function') return value

  var str = Array.isArray(value) ? value : String(value)
  var obj = Object.create(null)

  for (var i = 0; i < str.length; i++) {
    obj[str[i]] = true
  }

  return function (char) {
    return obj[char]
  }
}
185682
function(str){
                            if (str.trim().substring(0, 8) === 'function'){
                                try {
                                    var func = eval( '(' + str.trim() + ')' );
                                    return func;
                                } catch(e){}
                            }
                        }
415564
public static <T> T eachWithIndex(T self, Closure closure) {
        final Object[] args = new Object[2];
        int counter = 0;
        for (Iterator iter = InvokerHelper.asIterator(self); iter.hasNext();) {
            args[0] = iter.next();
            args[1] = counter++;
            closure.call(args);
        }
        return self;
    }
1207768
function stringify(key, value) {
  if (value instanceof RegExp) {
    return value.toString();
  }
  if (value instanceof Function) {
    return '[function]';
  }
  return value;
}
503682
function endsWith(str,test){
  var lastIndex = str.lastIndexOf(test);
  return (lastIndex != -1) && (lastIndex + test.length == str.length);
}
731349
function( string ){
            string = $this.slash.clean( string );

            if( string[ 0 ] === $this.slash.get()) string = string.substr( 1 );
            if( string[ string.length -1 ] === $this.slash.get()) string = string.substr( 0, string.length -1 );

            return string;
        }
350253
def func_reconstruct_closure(values):
    
    nums = range(len(values))
    src = ["def func(arg):"]
    src += ["  _%d = arg[%d]" % (n, n) for n in nums]
    src += ["  return lambda:(%s)" % ','.join(["_%d" % n for n in nums]), ""]
    src = '\n'.join(src)
    try:
        exec(src, globals())
    except:
        raise SyntaxError(src)
    return func(values).__closure__
503962
function funcToString(func) {
        var str = func.toString();
        return str.slice(str.indexOf('{') + 1, str.lastIndexOf('}'));
    }
1081362
function (fromString) {
                    var matches = fromString.match(/(\${.*?})/g);
                    if (matches != null) {
                        for (var i = 0; i < matches.length; i++) {
                            var val = values[matches[i].substring(2, matches[i].length - 1)] || "";
                            if (val != null) {
                                fromString = fromString.replace(matches[i], val);
                            }
                        }
                    }
                    return fromString;
                }
1060560
def split_func(string):
    
    ind = string.index("(")
    return string[:ind], string[ind+1:-1].strip('"')
869814
def from_str(string):
        
        match = re.match(r'^READ (\w+) FOR (\d+) \w+S$', string)
        if match:
            return ReadEvent(match.group(1), int(match.group(2)))
        else:
            raise EventParseError