MCPcopy
hub / github.com/gvergnaud/ts-pattern / fn

Function fn

tests/select.test.ts:471–480  ·  view source on GitHub ↗
(input: string[])

Source from the content-addressed store, hash-verified

469
470 it('should work with variadic tuples', () => {
471 const fn = (input: string[]) =>
472 match(input)
473 .with(
474 [P.string, 'some', 'cli', 'cmd', P.select(), ...P.array()],
475 (arg) => {
476 type t = Expect<Equal<typeof arg, string>>;
477 return arg;
478 }
479 )
480 .otherwise(() => '2');
481
482 expect(fn(['some cli cmd param', 'some', 'cli', 'cmd', 'param'])).toEqual(
483 'param'

Callers 1

select.test.tsFile · 0.70

Calls 4

matchFunction · 0.90
otherwiseMethod · 0.80
withMethod · 0.80
selectMethod · 0.80

Tested by

no test coverage detected