message: Extract findParamMatchingId() and add docs
diff: @@ -5,6 +5,7 @@ import {
  ErrorReason
  } from "../../editor/i-show-error-message";
  import * as ast from "../../ast";
  +import { findParamMatchingId } from "./find-param-matching-id";
  export { inlineFunction };
  @@ -118,110 +119,3 @@ function applyArgumentsToFunction(
  return functionBlockStatement.body;
  }
  -
  -function findParamMatchingId(
  - id: ast.Identifier,
  - params: ast.Node[]
  -): MatchingParam {
  - return params.reduce((result: MatchingParam, param, index) => {
  - if (result.isMatch) return result;
  -
  - if (ast.isIdentifier(param) && param.name === id.name) {
  - return new MatchingIdentifier(index);
  - }
  -
  - if (ast.isArrayPattern(param)) {
  - return new MatchingArray(index, findParamMatchingId(id, param.elements));
  - }
  -
  - if (ast.isObjectPattern(param)) {
  - const values = getPropertiesValues(param);
  - return new MatchingObject(index, findParamMatchingId(id, values));
  - }
  -
  - return result;
  - }, new NoMatch());
  -}
  -
  -function getPropertiesValues(
  - param: ast.ObjectPattern
  -): ast.ObjectProperty["value"][] {
  - return param.properties
  - .map(property => {
  - if (ast.isRestElement(property)) return null;
  - return property.value;
  - })
  - .filter((el): el is ast.ObjectProperty["value"] => el !== null);
  -}
  -
  -interface MatchingParam {
  - isMatch: boolean;
  - resolveValue: (args: Value[]) => Value;
  -}
  -
  -type Value = ast.Node | null;
  -
  -class MatchingIdentifier implements MatchingParam {
  - isMatch = true;
  - private index: number;
  -
  - constructor(index: number) {
  - this.index = index;
  - }
  -
  - resolveValue(args: Value[]) {
  - return args[this.index];
  - }
  -}
  -
  -class MatchingArray implements MatchingParam {
  - private matchingParam: MatchingParam;
  - private index: number;
  -
  - constructor(index: number, matchingParam: MatchingParam) {
  - this.index = index;
  - this.matchingParam = matchingParam;
  - }
  -
  - get isMatch() {
  - return this.matchingParam.isMatch;
  - }
  -
  - resolveValue(args: Value[]) {
  - const value = args[this.index];
  - if (!ast.isArrayExpression(value)) return null;
  - return this.matchingParam.resolveValue(value.elements);
  - }
  -}
  -
  -class MatchingObject implements MatchingParam {
  - private index: number;
  - private matchingParam: MatchingParam;
  -
  - constructor(index: number, matchingParam: MatchingParam) {
  - this.index = index;
  - this.matchingParam = matchingParam;
  - }
  -
  - get isMatch() {
  - return this.matchingParam.isMatch;
  - }
  -
  - resolveValue(args: Value[]) {
  - const value = args[this.index];
  - if (!ast.isObjectExpression(value)) return null;
  -
  - const property = this.matchingParam.resolveValue(value.properties);
  - if (!ast.isObjectProperty(property)) return null;
  -
  - return property.value;
  - }
  -}
  -
  -class NoMatch implements MatchingParam {
  - isMatch = false;
  -
  - resolveValue() {
  - return null;
  - }
  -}
  