TODO: Support multiple pathToNesteds...
424016
function highlightResults(highlightFields, hit, pathToNested, include) {
  // TODO: Support Regex and Function basis for all options

  // Handle Results Highlighting
  let additionalFields = []
  _.each(hit.highlight, (value, key) => {
    // Populate Additional Fields
    let additionalMatches = anyRegexesMatch(highlightFields.additional, key)
    // Exclude explicit exclusions, inline, and nested highlight fields
    let additionalExclusionMatches =
      anyRegexesMatch(highlightFields.additionalExclusions, key) ||
      anyRegexesMatch(highlightFields.inline, key) ||
      anyRegexesMatch(highlightFields.nested, key)
    // If we have an include array, and if the field is inline but is not in the includes, add it to the additionalFields
    let inlineButNotIncluded =
      include && _.includes(_.difference(highlightFields.inline, include), key)

    if (
      inlineButNotIncluded ||
      (additionalMatches && !additionalExclusionMatches)
    ) {
      additionalFields.push({
        label: key,
        value: value[0],
      })
    } else if (_.includes(highlightFields.nested, key)) {
      // Handle Nested Item Highlighting Replacement

      if (_.isArray(value) && !_.includes(key, pathToNested)) {
        additionalFields.push({
          label: key,
          value,
        })
      } else {
        // Handle Nested Item Highlighting Replacement
        if (key === pathToNested)
          // Clarify [{a}, {b}] case and not [a,b] case (ie, does not handle http://stackoverflow.com/questions/25565546/highlight-whole-content-in-elasticsearch-for-multivalue-fields)
          throw new Error('Arrays of scalars not supported')

        let field = key.replace(`${pathToNested}.`, '')
        // For arrays, strip the highlighting wrapping and compare to the array contents to match up
        _.each(value, function(val) {
          let originalValue = val.replace(/<b>|<\/b>/g, '')
          let childItem = _.find(
            _.get(hit._source, pathToNested),
            item => item[field] === originalValue
          )
          if (childItem) childItem[field] = val
        })
      }
    }
  })
  let mainHighlighted = false
  // Copy over all inline highlighted fields
  if (hit.highlight) {
    _.each(highlightFields.inline, val => {
      if (hit.highlight[val]) {
        _.set(hit._source, val, hit.highlight[val][0])
        mainHighlighted = true
      }
    })
  }

  return {
    additionalFields,
    mainHighlighted,
  }
}
914185
function pathExtend(p) {
  if (!exists(p)) return false
  loaded.push(p)
  return extend(config, require(p))
}
165079
function convertPathMatcher (cfg) {
				var pathMap = cfg.pathMap;
				cfg.pathRx = new RegExp('^(' +
					cfg.pathList.sort(function (a, b) { return pathMap[b].specificity - pathMap[a].specificity; } )
						.join('|')
						.replace(/\/|\./g, '\\$&') +
					')(?=\\/|$)'
				);
				delete cfg.pathList;
			}
1163718
public static String pathLinker(String path1,String path2){
        if ((path1 == null || path1.equals("")) && (path2 == null || path2.equals(""))){
            return null;
        }

        if (path1 == null || path1.equals("")){
            return path2;
        }

        if (path2 == null || path2.equals("")){
            return path1;
        }

        if (path1.endsWith(File.separator)){
            path1 = path1.substring(0,path1.length() - 1);
        }

        if (path2.startsWith(File.separator)){
            path2 = path2.substring(1,path2.length());
        }

        if (path2.endsWith(File.separator)){
            path2 = path2.substring(0,path2.length() - 1);
        }

        return path1 + File.separator + path2;
    }
892338
def _pathify(self):
        
        try:
            (path,
             query,
             self._fragment) = urisup.uri_help_split(self.path)[2:]

            if not path:
                path = "/"

            if path[0] != "/":
                raise urisup.InvalidURIError('path %r does not start with "/"' % path)

            self._path = re.sub("^/+", "/", path, 1)

            if query:
                self._query_params = self.querylist_to_dict(query)

            return self._path
        except urisup.InvalidURIError, e:
            LOG.error("invalid URI: %s", e)
            raise self.req_error(400, str(e))
739296
function getSourceTrees(pathsToSearch) {
	return {
		read: function(readTree) {
			var promises = _.map(pathsToSearch, function(path) {
				return new Promise(function(resolve) {
					fs.exists(path, function(exists) {
						resolve((exists) ? path : null);
					});
				});
			});

			return Promise.all(promises)
				.then(function(paths) {
					paths = _.filter(paths);
					if (paths.length === 0) throw new Error('No source paths found');
					return paths;
				})
				.then(function(paths) {
					console.log('Found source paths: ' + paths.join(', '));

					var pathTrees = _.map(paths, function(path) {
						return new Funnel(path, { srcDir: '.', destDir: path });
					});

					return readTree(mergeTrees(pathTrees));
				});
		},

		cleanup: function() {}
	};
}
902761
function pathMatch(root, path) {
	var len = root.length;
	if (root[len-1] === '/') {
		root = root.substring(0, --len - 1);
	}
	return path.substring(0, len) === root && (path.length <= len || path[len] === '/');
}
284988
public void pushNestedPath(final String subPath, final String key) {
        final String canonicalPath = normalizePath(subPath);
        ArgUtils.notEmpty(subPath, "subPath");
        ArgUtils.notEmpty(key, "key");
        
        pushNestedPath(String.format("%s[%s]", canonicalPath, key));
    }
135413
public static <R> List<R> applyPathListAndGetResultList(boolean isParallel,
			List<Path> pathList, Function<Path, R> function) {
		return JMStream.buildStream(isParallel, pathList).map(function)
				.collect(toList());
	}
913556
function getOpParams(pathParams, opParams) {
  var unionParams = _.unionWith(opParams, pathParams, opParamComparator);
  return unionParams;
}
336048
function PathnameEnvironment() {
  this.onPopState = this.onPopState.bind(this);
  this.useHistoryApi = !!(window.history &&
                          window.history.pushState &&
                          window.history.replaceState);
  Environment.call(this);
}
1104338
function matchPaths(pageLinks, path) {
  let result;
  path = _.compact(path.split('/'));
  result = _.filter(_.keys(pageLinks), key => {
    const path2 = _.compact(key.split('/'));
    const noMatch = _.filter(path2, fragment => {
      return fragment.substring(0, 1) !== ':' && _.indexOf(path, fragment) !== _.indexOf(path2, fragment);
    });
    return noMatch.length === 0;
  });
  return result[0];
}
1146773
function updatePersistentPath(client, path, data, callback) {
  debug('updatePersistentPath: "%s" "%s"', path, data);

  data = ensureBuffer(data);

  client.setData(path, data, function (err) {
    if (err) {
      if (err.code !== NO_NODE)
        return callback(err);

      createParentPath(client, path, function(err) {
        if (err) return callback(err);

        client.create(path, data, function(err) {
          if (err) {
            if (err.code !== NODE_EXISTS)
              return callback(err);
            client.setData(path, data, callback);
          } else
            callback(null);
        });
      });
    } else
      callback(null);
  });
}
1315063
def multiple_paths_parser(value):
    
    if isinstance(value, six.string_types):
        value = value.split(os.path.pathsep)
    return value
463435
function(replace, count, callback) {
    return pathmap.replace(
      pathmap.basename(this, pathmap.extname(this)), replace, callback);
  }
116555
function (subpath) {
    var subpathAsArray = asArrayPath(subpath);
    if (!Util.undefinedOrNull(this.get(subpathAsArray))) {
      update(this, subpathAsArray, clear);
    }
    return this;
  }
1063062
@Override
  public PathImpl schemeWalk(String userPath,
                         Map<String,Object> newAttributes,
                         String uri,
                         int offset)
  {
    int length = uri.length();

    if (length < 2 + offset
        || uri.charAt(offset) != '/'
        || uri.charAt(1 + offset) != '/')
      throw new RuntimeException("bad scheme");

    CharBuffer buf = new CharBuffer();
    int i = 2 + offset;
    int ch = 0;
    boolean isIpv6 = false;
    
    for (; 
          (i < length
           && (ch = uri.charAt(i)) != '/'
           && ch != '?'
           && ! (ch == ':' && ! isIpv6));
         i++) {
      if (ch == '[')
        isIpv6 = true;
      else if (ch == ']')
        isIpv6 = false;
      
      buf.append((char) ch);
    }

    String host = buf.toString();
    if (host.length() == 0)
      throw new RuntimeException("bad host");

    int port = 0;
    if (ch == ':') {
      for (i++; i < length && (ch = uri.charAt(i)) >= '0' && ch <= '9'; i++) {
        port = 10 * port + uri.charAt(i) - '0';
      }
    }

    return create(this, userPath, newAttributes, host, port);
  }