MCPcopy Create free account
hub / github.com/angular/angular / toInteger

Function toInteger

packages/forms/src/directives/validators.ts:41–43  ·  view source on GitHub ↗

* Method that updates string to integer if not already a number * * @param value The value to convert to integer. * @returns value of parameter converted to number or integer.

(value: string | number)

Source from the content-addressed store, hash-verified

39 * @returns value of parameter converted to number or integer.
40 */
41function toInteger(value: string | number): number {
42 return typeof value === 'number' ? value : parseInt(value, 10);
43}
44
45/**
46 * Method that ensures that provided value is a float (and converts it to float if needed).

Callers 2

MinLengthValidatorClass · 0.85
MaxLengthValidatorClass · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected