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

FontoXML / fontoxpath / 6234074041

19 Sep 2023 10:08AM UTC coverage: 91.578%. First build
6234074041

push

github

DrRataplan
Update testcases csv

4961 of 5761 branches covered (0.0%)

Branch coverage included in aggregate %.

10665 of 11302 relevant lines covered (94.36%)

97712.03 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 = [
9✔
5
        ValueType.XSDOUBLE,
6
        ValueType.XSFLOAT,
7
        ValueType.XSDECIMAL,
8
        ValueType.XSINTEGER,
9
];
10

11
export default function castToNumeric(
9✔
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

© 2026 Coveralls, Inc