Return an array made by 2 elements:
- A boolean value as value for know if the current pattern matches the path
- An array with key/value as element to add to the request.
548674
private function matchByRegex(string $pattern, string $path): array
    {
        $isPatternMatched = (bool) \preg_match_all("~^$pattern$~", $path, $matches);

        if (!$isPatternMatched) {
            return [$isPatternMatched, []];
        }

        foreach ($matches as $k => $match) {
            $match = \array_shift($match);
            if (\is_int($k) || empty($match)) {
                unset($matches[$k]);
                continue;
            }
            $matches[$k] = $match;
        }

        return [$isPatternMatched, $matches];
    }
1130303
function arrayToObject ( keyPath, arr ) {
    var res = {}, key, element;

    for ( var i = 0, len = arr.length; i < len; i++ ) {
        element = arr[ i ];
        key     = getOrNull( element, keyPath );
        if ( key ) res[ key ] = element;
    }
    
    return res;
}
946217
function paths (object, test) {
  var p = []
  if(test(object)) return []
  for(var key in object) {
    var value = object[key]
    if(test(value)) p.push(key)
    else if(isObject(value))
      p = p.concat(paths(value, test).map(function (path) {
        return [key].concat(path)
      }))
  }
  return p
}
1079141
function join() {
        var paths = [];
        for (var _i = 0; _i < arguments.length; _i++) {
            paths[_i] = arguments[_i];
        }
        var tmp = [];
        var length = paths.length - 1;
        paths.forEach(function (path, index) {
            if (Core.isBlank(path)) {
                return;
            }
            if (path === '/') {
                tmp.push('');
                return;
            }
            if (index !== 0 && path.match(/^\//)) {
                path = path.slice(1);
            }
            if (index !== length && path.match(/\/$/)) {
                path = path.slice(0, path.length - 1);
            }
            if (!Core.isBlank(path)) {
                tmp.push(path);
            }
        });
        var rc = tmp.join('/');
        return rc;
    }
429074
def match_to_key(match, path, location)
      key   = super
      scope = match[1]
      if scope
        scope_parts = extract_literal_or_array_of_literals(scope)
        return nil if scope_parts.nil? || scope_parts.empty?
        "#{scope_parts.join('.')}.#{key}"
      else
        key unless match[0] =~ /\A\w/
      end
    end
1150177
def get(path, options = {})
      if options[:query].nil?
        options.merge!({ query: { api_key: @key } })
      else
        options[:query].merge!({ api_key: @key })
      end

      response = self.class.get path, options
      raise LoLBaseError, response.message if response.code != 200
      response.body
    end
82285
def []=(key, value)
      new_entry = entry_to_modify(key, value)
      new_entry[:key] = key
      new_entry[:value] = value
    end
97980
function (path) {
        var str = [];
        for (var i = 0; i < path.length; i++) {
            var el = path[i];
            if (el.type === TYPE_VAR) {
                str.push(el.name);
            } else {
                return false;
            }
        }
        return str.join(".");
    }
1231580
def get_as_array(self, key):
        
        value = self.get(key)
        return AnyValueMap.from_value(value)
622979
function (jsonObject, path, force, value) {
  if (!path) {
    return;
  }
  var newValue, obj;
  obj = jsonObject || {};
  path.trim().split('.').some(function (key, index, array) {
    if (!key && key !== 0) {
      return false;
    }
    newValue = obj[key];
    if (index == array.length - 1) {
      if (value === undefined) {
        value = {};
      }
      obj[key] = value;
      return true;
    }
    if (!newValue && newValue != 0 && index <= (array.length - 1)) {
      if (force) {
        obj[key] = {};
      } else {
        return true;
      }
    }
    obj = obj[key];
  });

  return jsonObject;
}
825534
function matchArray(value, pattern, options) {
  if (!(value instanceof Array)) {
    return false;
  }
  if (!options.matchPartialArrays && pattern.length !== value.length) {
    return false;
  }
  if (pattern.length > value.length) {
    return false;
  }
  if (options.matchOutOfOrderArrays) {
    return pattern.every(
      (nestedMatch) => value.some(
        (nestedValue) => matchr(nestedValue, nestedMatch, options)
      )
    );
  }
  let valueIndex = 0;
  for (const nestedMatcher of pattern) {
    while (valueIndex < value.length && !matchr(value[valueIndex], nestedMatcher, options)) {
      valueIndex++;
    }
    if (valueIndex === value.length) {
      return false;
    }
  }
  return true;
}
1222921
def [](path)
      first, *rest_path = path.split("/")  
      obj = case first
      when nil
        if path == "/"
          root
        elsif path == ""
          self
        end
      when ""
        root
      when ".."
        parent
      when "."
        self
      else
        children[first.to_sym]
      end

      return nil if obj.nil?
      if rest_path.size > 0
        obj[rest_path.join("/")]
      else
        obj
      end
    end
374184
function getPath(pathType = 'array', _path) {
  return {
    _path: _path || (pathType === 'array' ? [] : ''),
    set(parent, key) {
      let nextPath;
      switch (pathType) {
        case 'array':
          nextPath = this._path.concat([key]);
          break;

        case 'nestedProperty':
          if (this._path.length === 0) {
            nextPath = key;
          } else if (Array.isArray(parent)) {
            nextPath = this._path + `[${key}]`;
          } else {
            nextPath = this._path + '.' + key;
          }
          break;

        default:
          throw new Error('unrecognized pathType ' + pathType);
      }

      return getPath(pathType, nextPath);
    },

    get(parent, key) {
      // in array mode we do not return the leaf node key.
      if (pathType === 'array') {
        return this._path;
      }

      // in nestedProperty mode we return full path including final key
      return this.set(parent, key)._path;
    },
  };
}
1315062
def iscm_md_append_array(self, arraypath, member):
        
        array_path = string.split(arraypath, ".")
        array_key = array_path.pop()
        current = self.metadata
        for k in array_path:
            if not current.has_key(k):
                current[k] = {}
            current = current[k]
        if not current.has_key(array_key):
            current[array_key] = []
        if not type(current[array_key]) == list:
            raise KeyError("%s doesn't point to an array" % arraypath)
        current[array_key].append(member)
878805
def []=(key, value)
      return super if has_key?(key)
      alt = alternate_key(key)
      has_key?(alt) ? super(alt, value) : super
    end
740007
def find(self, path, all=False):
        
        try:
            start, _, extn = path.rsplit('.', 2)
        except ValueError:
            return []
        path = '.'.join((start, extn))
        return find(path, all=all) or []
710053
def find(self, path, all=False):
        
        matches = []
        for elem in chain(settings.STYLESHEETS.values(), settings.JAVASCRIPT.values()):
            if normpath(elem['output_filename']) == normpath(path):
                match = safe_join(settings.PIPELINE_ROOT, path)
                if not all:
                    return match
                matches.append(match)
        return matches