(type: MessageType, params: any[])
| 834 | } |
| 835 | |
| 836 | function computeMessageParams(type: MessageType, params: any[]): any | any[] | null { |
| 837 | let result: any | any[] | null; |
| 838 | let numberOfParams = type.numberOfParams; |
| 839 | switch (numberOfParams) { |
| 840 | case 0: |
| 841 | result = null; |
| 842 | break; |
| 843 | case 1: |
| 844 | result = undefinedToNull(params[0]); |
| 845 | break; |
| 846 | default: |
| 847 | result = []; |
| 848 | for (let i = 0; i < params.length && i < numberOfParams; i++) { |
| 849 | result.push(undefinedToNull(params[i])); |
| 850 | } |
| 851 | if (params.length < numberOfParams) { |
| 852 | for (let i = params.length; i < numberOfParams; i++) { |
| 853 | result.push(null); |
| 854 | } |
| 855 | } |
| 856 | break; |
| 857 | } |
| 858 | return result; |
| 859 | } |
| 860 | |
| 861 | let connection: MessageConnection = { |
| 862 | sendNotification: (type: string | MessageType, ...params: any[]): void => { |
no test coverage detected