You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: findPoleOrder.m
    path of file: ./repos/chebfun/@singfun
    
    the code of the file until where you have to start completion: function poleOrder = findPoleOrder(op, singEnd)
%FINDPOLEORDER   Find the order of the pole in a function handle at 1 or -1. 
%   FINDPOLEORDER(OP, SINGEND) finds the order of the pole in the function 
%   handle OP at the point x = 1 or x = -1 depending upon the string 'right' 
%   or 'left' passed in SINGEND.
%   
%   Example:
%     p = singfun.findPoleOrder(@(x) 1./(1 - x), 'right')
%     p = singfun.findPoleOr
    
function poleOrder = poleOrderFinder(fvals, x)
%POLEORDERFINDER   Finds the order of the pole based on function values
%   FVALS given at (1-X).

% We take the absolute value of the function values now and don't call ABS()
% later. This works because scaling with powers of the positive factor (1-x)
% don't change the sign of function values. 
smoothVals = abs(fvals);
ind = isinf(smoothVals);
smoothVals(ind) = [];
x(ind) = [];

if ( any(isinf(smoothVals)) )
    error('CHEBFUN:SINGFUN:findPoleOrder:infEval', ...
        'Function returned inf value.')
end