All files / blong-gogo/src Port.ts

84% Statements 21/25
100% Branches 2/2
50% Functions 2/4
84% Lines 21/25

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 261x 1x 1x 1x 11x 11x     11x 1x 1x 1x 1x 1x 1x 1x 11x 11x 11x 11x     11x 11x 1x  
import {Internal, type IAdapterFactory} from '@feasibleone/blong/types';
// import {Port as UtPort} from 'ut-port';
 
const UtPort = () =>
    class Port extends Internal {
        findHandler(_: string): unknown {
            return null;
        }
    };
 
export interface IPort {
    new (portApi: Parameters<IAdapterFactory>[0] & {config: unknown; configBase: string}): unknown;
}
 
export default class Port extends Internal {
    public constructor() {
        super();
        const result = UtPort();
        const findHandler = result.prototype.findHandler;
        result.prototype.findHandler = function (name: string) {
            return findHandler.call(this, name.replaceAll('.', '').toLowerCase());
        };
        return result as unknown as Port;
    }
}