code: function getDeclarationParent(path) {
    do {
      if (
        path.isFunctionDeclaration() ||
        path.isVariableDeclaration() ||
        path.isClassDeclaration() ||
        path.isAssignmentExpression()
      ) {
        return path;
      }
    } while ((path = path.parentPath));
  }
docs: Retrieve declaration parent for 'path'
  @param {NodePath} path
  @returns {NodePath}