MCPcopy Create free account
hub / github.com/SincereCSL/Playgrounds / add8

Function add8

TypeScript/StudyTypeScript/src/function.ts:42–50  ·  view source on GitHub ↗
(...rest: any[])

Source from the content-addressed store, hash-verified

40function add8(...rest: number[]): number
41function add8(...rest: string[]): string
42function add8(...rest: any[]): any {
43 let first = rest[0];
44 if(typeof first === 'string'){
45 return rest.join('')
46 }
47 if(typeof first === 'number'){
48 return rest.reduce((pre,cur)=> pre + cur)
49 }
50}
51console.log(add8(1,2,3))
52console.log(add8('a','b', 'c'))

Callers 1

function.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected