Constructor
new Converter(options)
Constructs an immutable instance of Converter.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
options |
Object |
<optional> |
an object literal used to provide an optional information to initialize the converter. |
- Source:
- ojvalidation/Converter.js, line 18
Methods
-
format(value) → {String|null}
-
Formats the value using the options provided.
Parameters:
Name Type Description value
Number | Date the value to be formatted for display - Source:
- ojvalidation/Converter.js, line 84
Throws:
if formatting fails.- Type
- Error
Returns:
the localized and formatted value suitable for display- Type
- String | null
-
getHint() → {String|null}
-
Returns a hint that describes the converter format expected.
- Source:
- ojvalidation/Converter.js, line 46
Returns:
a hint describing the format the value is expected to be in.- Type
- String | null
-
getOptions() → {Object}
-
Returns the options called with converter initialization.
- Source:
- ojvalidation/Converter.js, line 57
Returns:
an object of options.- Type
- Object
-
Init(options)
-
Initializes converter instance with the set options
Parameters:
Name Type Argument Description options
Object <optional>
an object literal used to provide an optional information to initialize the converter. - Source:
- ojvalidation/Converter.js, line 33
-
parse(value) → {Number|Date}
-
Parses a String value using the options provided.
Parameters:
Name Type Description value
String to parse - Source:
- ojvalidation/Converter.js, line 70
Throws:
if parsing fails- Type
- Error
Returns:
the parsed value.- Type
- Number | Date
-
resolvedOptions() → {Object}
-
Returns an object literal with locale and formatting options computed during initialization of the object. If options was not provided at the time of initialization, the properties will be derived from the locale defaults.
- Source:
- ojvalidation/Converter.js, line 97
Returns:
an object of resolved options.- Type
- Object