• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

FontoXML / fontoxpath / 4161802573

pending completion
4161802573

push

github

GitHub
Implement circular dependencies and partial modules

4894 of 5691 branches covered (86.0%)

Branch coverage included in aggregate %.

10517 of 11154 relevant lines covered (94.29%)

32506.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

20.0
/src/expressions/dataTypes/casting/castToNumeric.ts
1
import { ValueType } from '../Value';
2
import CastResult from './CastResult';
3

4
const numericTypes = [
3✔
5
        ValueType.XSDOUBLE,
6
        ValueType.XSFLOAT,
7
        ValueType.XSDECIMAL,
8
        ValueType.XSINTEGER,
9
];
10

11
export default function castToNumeric(
3✔
12
        inputType: ValueType,
13
        castToPrimitiveType: (inputType: ValueType, outputType: ValueType) => (value: any) => CastResult
14
): (value: any) => CastResult {
15
        return (value) => {
×
16
                for (const outputType of numericTypes) {
×
17
                        const result = castToPrimitiveType(inputType, outputType)(value);
×
18
                        if (result.successful) {
×
19
                                return result;
×
20
                        }
21
                }
22
                // In the case of failure, return the result of the last attempt
23
                return {
×
24
                        successful: false,
25
                        error: new Error(
26
                                `XPTY0004: Casting not supported from "${value}" given type to xs:numeric or any of its derived types.`
27
                        ),
28
                };
29
        };
30
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc