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

FontoXML / fontoxpath / 10315429919

09 Aug 2024 07:30AM UTC coverage: 91.567%. Remained the same
10315429919

push

github

DrRataplan
Add test for atomizing DocumentFragments

5002 of 5811 branches covered (86.08%)

Branch coverage included in aggregate %.

10775 of 11419 relevant lines covered (94.36%)

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

11
export default function castToNumeric(
15✔
12
        inputType: ValueType,
13
        castToPrimitiveType: (
14
                inputType: ValueType,
15
                outputType: ValueType,
16
        ) => (value: any) => CastResult,
17
): (value: any) => CastResult {
18
        return (value) => {
×
19
                for (const outputType of numericTypes) {
×
20
                        const result = castToPrimitiveType(inputType, outputType)(value);
×
21
                        if (result.successful) {
×
22
                                return result;
×
23
                        }
24
                }
25
                // In the case of failure, return the result of the last attempt
26
                return {
×
27
                        successful: false,
28
                        error: new Error(
29
                                `XPTY0004: Casting not supported from "${value}" given type to xs:numeric or any of its derived types.`,
30
                        ),
31
                };
32
        };
33
}
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