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

FontoXML / fontoxpath / 6107185957

07 Sep 2023 08:15AM UTC coverage: 91.555%. Remained the same
6107185957

push

github

DrRataplan
3.30.1

4938 of 5738 branches covered (0.0%)

Branch coverage included in aggregate %.

10640 of 11277 relevant lines covered (94.35%)

97908.84 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

© 2025 Coveralls, Inc