(file: string, data: Buffer | string)
| 40 | } |
| 41 | |
| 42 | function parseFont(file: string, data: Buffer | string): LoadedFont { |
| 43 | if (isBinary(data)) { |
| 44 | if (typeof data === "string") { |
| 45 | data = Buffer.from(data, "binary"); |
| 46 | } |
| 47 | |
| 48 | return readBinary(data); |
| 49 | } |
| 50 | |
| 51 | data = data.toString().trim(); |
| 52 | |
| 53 | if (/.json$/.test(file) || data.charAt(0) === "{") { |
| 54 | return JSON.parse(data); |
| 55 | } |
| 56 | |
| 57 | if (/.xml$/.test(file) || data.charAt(0) === "<") { |
| 58 | return parseXML(data); |
| 59 | } |
| 60 | |
| 61 | return parseASCII(data); |
| 62 | } |
| 63 | |
| 64 | // eslint-disable-next-line @typescript-eslint/no-explicit-any |
| 65 | function parseNumbersInObject<T extends Record<string, any>>(obj: T) { |
no test coverage detected
searching dependent graphs…