(ast: ValueNode)
| 27 | throw new TypeError('Value must be a string, a float, or an array of strings and/or floats') |
| 28 | }, |
| 29 | parseLiteral(ast: ValueNode): string | number | (string | number)[] { |
| 30 | if (ast.kind === Kind.STRING) { |
| 31 | return ast.value |
| 32 | } else if (ast.kind === Kind.FLOAT) { |
| 33 | return parseFloat(ast.value) |
| 34 | } else if (ast.kind === Kind.LIST) { |
| 35 | const values = ast.values.map(valueNode => { |
| 36 | if (valueNode.kind === Kind.STRING) { |
| 37 | return valueNode.value |
| 38 | } else if (valueNode.kind === Kind.FLOAT) { |
| 39 | return parseFloat(valueNode.value) |
| 40 | } |
| 41 | throw new TypeError('All elements in the array must be strings or floats') |
| 42 | }) |
| 43 | return values |
| 44 | } |
| 45 | throw new TypeError('Value must be a string, a float, or an array of strings and/or floats') |
| 46 | } |
| 47 | }) |
| 48 | |
| 49 | export default StringOrFloatOrArray |
nothing calls this directly
no outgoing calls
no test coverage detected