1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | Object.defineProperty(exports, "__esModule", { value: true });
|
7 | exports.StringType = void 0;
|
8 |
|
9 |
|
10 |
|
11 |
|
12 | class StringType {
|
13 | constructor() {
|
14 | this.name = 'string';
|
15 | }
|
16 | isInstance(value) {
|
17 | return value == null || typeof value === 'string';
|
18 | }
|
19 | isCoercible(value) {
|
20 | return true;
|
21 | }
|
22 | defaultValue() {
|
23 | return '';
|
24 | }
|
25 | coerce(value) {
|
26 | if (value == null)
|
27 | return value;
|
28 | if (typeof value.toJSON === 'function') {
|
29 | value = value.toJSON();
|
30 | }
|
31 | if (typeof value === 'object') {
|
32 | return JSON.stringify(value);
|
33 | }
|
34 | return String(value);
|
35 | }
|
36 | serialize(value) {
|
37 | return value;
|
38 | }
|
39 | }
|
40 | exports.StringType = StringType;
|
41 |
|
\ | No newline at end of file |