decoders 2.1.0 → 2.2.0-test2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -12
- package/annotate-0PUmWHxH.d.ts +33 -0
- package/chunk-BPSZE2VX.js +13 -0
- package/chunk-RUMDX66L.js +179 -0
- package/dist/annotate-0PUmWHxH.d.mts +33 -0
- package/dist/annotate-0PUmWHxH.d.ts +33 -0
- package/dist/chunk-BPSZE2VX.js +13 -0
- package/dist/chunk-BPSZE2VX.js.map +1 -0
- package/dist/chunk-HBFFQIIN.mjs +13 -0
- package/dist/chunk-HBFFQIIN.mjs.map +1 -0
- package/dist/chunk-RUMDX66L.js +179 -0
- package/dist/chunk-RUMDX66L.js.map +1 -0
- package/dist/chunk-ZTKFAKRL.mjs +179 -0
- package/dist/chunk-ZTKFAKRL.mjs.map +1 -0
- package/dist/format.d.mts +9 -0
- package/dist/format.d.ts +9 -0
- package/dist/format.js +13 -0
- package/dist/format.js.map +1 -0
- package/dist/format.mjs +13 -0
- package/dist/format.mjs.map +1 -0
- package/dist/index.d.mts +454 -0
- package/dist/index.d.ts +454 -0
- package/dist/index.js +659 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +659 -0
- package/dist/index.mjs.map +1 -0
- package/dist/result.d.mts +26 -0
- package/dist/result.d.ts +26 -0
- package/dist/result.js +9 -0
- package/dist/result.js.map +1 -0
- package/dist/result.mjs +9 -0
- package/dist/result.mjs.map +1 -0
- package/format.d.ts +7 -4
- package/format.js +12 -116
- package/index.d.ts +454 -40
- package/index.js +659 -67
- package/package.json +163 -100
- package/result.d.ts +25 -15
- package/result.js +6 -18
- package/CHANGELOG.md +0 -670
- package/Decoder.d.ts +0 -94
- package/Decoder.js +0 -105
- package/Decoder.js.flow +0 -286
- package/Decoder.mjs +0 -101
- package/NotSupportedTSVersion.d.ts +0 -1
- package/_utils.d.ts +0 -9
- package/_utils.js +0 -80
- package/_utils.js.flow +0 -107
- package/_utils.mjs +0 -70
- package/annotate.d.ts +0 -62
- package/annotate.js +0 -145
- package/annotate.js.flow +0 -218
- package/annotate.mjs +0 -131
- package/format.js.flow +0 -128
- package/format.mjs +0 -110
- package/index.js.flow +0 -44
- package/index.mjs +0 -11
- package/lib/_helpers.d.ts +0 -79
- package/lib/arrays.d.ts +0 -59
- package/lib/arrays.js +0 -85
- package/lib/arrays.js.flow +0 -138
- package/lib/arrays.mjs +0 -75
- package/lib/basics.d.ts +0 -93
- package/lib/basics.js +0 -74
- package/lib/basics.js.flow +0 -124
- package/lib/basics.mjs +0 -60
- package/lib/booleans.d.ts +0 -16
- package/lib/booleans.js +0 -21
- package/lib/booleans.js.flow +0 -22
- package/lib/booleans.mjs +0 -15
- package/lib/dates.d.ts +0 -15
- package/lib/dates.js +0 -23
- package/lib/dates.js.flow +0 -40
- package/lib/dates.mjs +0 -17
- package/lib/json.d.ts +0 -35
- package/lib/json.js +0 -25
- package/lib/json.js.flow +0 -50
- package/lib/json.mjs +0 -18
- package/lib/numbers.d.ts +0 -31
- package/lib/numbers.js +0 -34
- package/lib/numbers.js.flow +0 -46
- package/lib/numbers.mjs +0 -25
- package/lib/objects.d.ts +0 -76
- package/lib/objects.js +0 -138
- package/lib/objects.js.flow +0 -238
- package/lib/objects.mjs +0 -128
- package/lib/strings.d.ts +0 -54
- package/lib/strings.js +0 -54
- package/lib/strings.js.flow +0 -90
- package/lib/strings.mjs +0 -40
- package/lib/unions.d.ts +0 -55
- package/lib/unions.js +0 -82
- package/lib/unions.js.flow +0 -155
- package/lib/unions.mjs +0 -75
- package/lib/utilities.d.ts +0 -40
- package/lib/utilities.js +0 -44
- package/lib/utilities.js.flow +0 -65
- package/lib/utilities.mjs +0 -35
- package/result.js.flow +0 -26
- package/result.mjs +0 -15
package/package.json
CHANGED
|
@@ -1,105 +1,168 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
"name": "decoders",
|
|
3
|
+
"version": "2.2.0-test2",
|
|
4
|
+
"description": "Elegant and battle-tested validation library for type-safe input data for TypeScript",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/nvie/decoders.git"
|
|
9
|
+
},
|
|
10
|
+
"author": "Vincent Driessen",
|
|
11
|
+
"homepage": "https://github.com/nvie/decoders#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/nvie/decoders/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "commonjs",
|
|
16
|
+
"main": "./dist/index.js",
|
|
17
|
+
"module": "./dist/index.mjs",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./dist/index.d.mts",
|
|
23
|
+
"default": "./dist/index.mjs"
|
|
24
|
+
},
|
|
25
|
+
"require": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"module": "./dist/index.mjs",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
}
|
|
9
30
|
},
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
31
|
+
"./format": {
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./dist/format.d.mts",
|
|
34
|
+
"default": "./dist/format.mjs"
|
|
35
|
+
},
|
|
36
|
+
"require": {
|
|
37
|
+
"types": "./dist/format.d.ts",
|
|
38
|
+
"module": "./dist/format.mjs",
|
|
39
|
+
"default": "./dist/format.js"
|
|
40
|
+
}
|
|
14
41
|
},
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
"then",
|
|
26
|
-
"compose",
|
|
27
|
-
"constant",
|
|
28
|
-
"date",
|
|
29
|
-
"decode",
|
|
30
|
-
"decoder",
|
|
31
|
-
"decoders",
|
|
32
|
-
"define",
|
|
33
|
-
"describe",
|
|
34
|
-
"dict",
|
|
35
|
-
"either",
|
|
36
|
-
"email",
|
|
37
|
-
"exact",
|
|
38
|
-
"fail",
|
|
39
|
-
"hardcoded",
|
|
40
|
-
"httpsUrl",
|
|
41
|
-
"inexact",
|
|
42
|
-
"instanceOf",
|
|
43
|
-
"integer",
|
|
44
|
-
"iso8601",
|
|
45
|
-
"json",
|
|
46
|
-
"jsonArray",
|
|
47
|
-
"jsonObject",
|
|
48
|
-
"lazy",
|
|
49
|
-
"map",
|
|
50
|
-
"mapping",
|
|
51
|
-
"maybe",
|
|
52
|
-
"mixed",
|
|
53
|
-
"mixedarray",
|
|
54
|
-
"never",
|
|
55
|
-
"nonEmptyArray",
|
|
56
|
-
"nonEmptyString",
|
|
57
|
-
"nullable",
|
|
58
|
-
"null_",
|
|
59
|
-
"number",
|
|
60
|
-
"numericBoolean",
|
|
61
|
-
"object",
|
|
62
|
-
"oneOf",
|
|
63
|
-
"optional",
|
|
64
|
-
"poja",
|
|
65
|
-
"pojo",
|
|
66
|
-
"positiveInteger",
|
|
67
|
-
"positiveNumber",
|
|
68
|
-
"predicate",
|
|
69
|
-
"prep",
|
|
70
|
-
"regex",
|
|
71
|
-
"set",
|
|
72
|
-
"string",
|
|
73
|
-
"taggedUnion",
|
|
74
|
-
"transform",
|
|
75
|
-
"truthy",
|
|
76
|
-
"tuple",
|
|
77
|
-
"tuple2",
|
|
78
|
-
"undefined_",
|
|
79
|
-
"unknown",
|
|
80
|
-
"url",
|
|
81
|
-
"uuid",
|
|
82
|
-
"uuidv1",
|
|
83
|
-
"uuidv4",
|
|
84
|
-
"verify",
|
|
85
|
-
"DecodeResult",
|
|
86
|
-
"DecoderType",
|
|
87
|
-
"JSONArray",
|
|
88
|
-
"JSONObject",
|
|
89
|
-
"JSONValue"
|
|
90
|
-
],
|
|
91
|
-
"githubUrl": "https://github.com/nvie/decoders",
|
|
92
|
-
"sideEffects": false,
|
|
93
|
-
"typesVersions": {
|
|
94
|
-
">=4.1.0": {
|
|
95
|
-
"*": [
|
|
96
|
-
"*"
|
|
97
|
-
]
|
|
98
|
-
},
|
|
99
|
-
"*": {
|
|
100
|
-
"*": [
|
|
101
|
-
"NotSupportedTSVersion.d.ts"
|
|
102
|
-
]
|
|
103
|
-
}
|
|
42
|
+
"./result": {
|
|
43
|
+
"import": {
|
|
44
|
+
"types": "./dist/result.d.mts",
|
|
45
|
+
"default": "./dist/result.mjs"
|
|
46
|
+
},
|
|
47
|
+
"require": {
|
|
48
|
+
"types": "./dist/result.d.ts",
|
|
49
|
+
"module": "./dist/result.mjs",
|
|
50
|
+
"default": "./dist/result.js"
|
|
51
|
+
}
|
|
104
52
|
}
|
|
53
|
+
},
|
|
54
|
+
"files": [
|
|
55
|
+
"dist/**",
|
|
56
|
+
"*.js",
|
|
57
|
+
"*.d.ts",
|
|
58
|
+
"LICENSE",
|
|
59
|
+
"README.md"
|
|
60
|
+
],
|
|
61
|
+
"scripts": {
|
|
62
|
+
"actually-prepublish": "echo \"\\n\\nPlease run \\`bin/publish.sh <options>\\` instead.\\n\\n\" && exit 2",
|
|
63
|
+
"build": "tsup && cp dist/*.js dist/*.d.ts .",
|
|
64
|
+
"docs": "cog -cr docs/*.md",
|
|
65
|
+
"lint": "eslint --color --report-unused-disable-directives src/**/*.ts test/**/*.ts && prettier --list-different src/ test/ test-d/",
|
|
66
|
+
"lint:docs": "cog -c --check docs/*.md || (npm run docs; git diff; echo 'Error: docs not up-to-date, please re-run \"npm docs\" to update them.' && exit 1)",
|
|
67
|
+
"lint:package": "publint --strict && attw --pack",
|
|
68
|
+
"format": "eslint --report-unused-disable-directives --fix src && prettier --write 'src/**/*.js'",
|
|
69
|
+
"test": "vitest run --coverage",
|
|
70
|
+
"test:completeness": "./bin/check.sh",
|
|
71
|
+
"test:typescript": "tsc --noEmit",
|
|
72
|
+
"test:types": "npm run build && tsd --typings ./dist/index.d.ts",
|
|
73
|
+
"release": "npm run test && npm run lint && npm run lint:docs && npm run build && npm run lint:package && release-it"
|
|
74
|
+
},
|
|
75
|
+
"keywords": [
|
|
76
|
+
"decoders",
|
|
77
|
+
"Decoder",
|
|
78
|
+
"always",
|
|
79
|
+
"and",
|
|
80
|
+
"array",
|
|
81
|
+
"boolean",
|
|
82
|
+
"then",
|
|
83
|
+
"compose",
|
|
84
|
+
"constant",
|
|
85
|
+
"date",
|
|
86
|
+
"decode",
|
|
87
|
+
"decoder",
|
|
88
|
+
"decoders",
|
|
89
|
+
"define",
|
|
90
|
+
"describe",
|
|
91
|
+
"dict",
|
|
92
|
+
"either",
|
|
93
|
+
"email",
|
|
94
|
+
"exact",
|
|
95
|
+
"fail",
|
|
96
|
+
"hardcoded",
|
|
97
|
+
"httpsUrl",
|
|
98
|
+
"inexact",
|
|
99
|
+
"instanceOf",
|
|
100
|
+
"integer",
|
|
101
|
+
"iso8601",
|
|
102
|
+
"json",
|
|
103
|
+
"jsonArray",
|
|
104
|
+
"jsonObject",
|
|
105
|
+
"lazy",
|
|
106
|
+
"map",
|
|
107
|
+
"mapping",
|
|
108
|
+
"maybe",
|
|
109
|
+
"mixed",
|
|
110
|
+
"mixedarray",
|
|
111
|
+
"never",
|
|
112
|
+
"nonEmptyArray",
|
|
113
|
+
"nonEmptyString",
|
|
114
|
+
"nullable",
|
|
115
|
+
"null_",
|
|
116
|
+
"number",
|
|
117
|
+
"numericBoolean",
|
|
118
|
+
"object",
|
|
119
|
+
"oneOf",
|
|
120
|
+
"optional",
|
|
121
|
+
"poja",
|
|
122
|
+
"pojo",
|
|
123
|
+
"positiveInteger",
|
|
124
|
+
"positiveNumber",
|
|
125
|
+
"predicate",
|
|
126
|
+
"prep",
|
|
127
|
+
"regex",
|
|
128
|
+
"set",
|
|
129
|
+
"string",
|
|
130
|
+
"taggedUnion",
|
|
131
|
+
"transform",
|
|
132
|
+
"truthy",
|
|
133
|
+
"tuple",
|
|
134
|
+
"tuple2",
|
|
135
|
+
"undefined_",
|
|
136
|
+
"unknown",
|
|
137
|
+
"url",
|
|
138
|
+
"uuid",
|
|
139
|
+
"uuidv1",
|
|
140
|
+
"uuidv4",
|
|
141
|
+
"verify",
|
|
142
|
+
"DecodeResult",
|
|
143
|
+
"DecoderType",
|
|
144
|
+
"JSONArray",
|
|
145
|
+
"JSONObject",
|
|
146
|
+
"JSONValue"
|
|
147
|
+
],
|
|
148
|
+
"devDependencies": {
|
|
149
|
+
"@arethetypeswrong/cli": "^0.13.5",
|
|
150
|
+
"@typescript-eslint/eslint-plugin": "^6.16.0",
|
|
151
|
+
"@typescript-eslint/parser": "^6.16.0",
|
|
152
|
+
"@vitest/coverage-istanbul": "^1.1.0",
|
|
153
|
+
"eslint": "^8.56.0",
|
|
154
|
+
"eslint-plugin-import": "^2.29.1",
|
|
155
|
+
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
156
|
+
"itertools": "^2.2.0",
|
|
157
|
+
"prettier": "^3.1.1",
|
|
158
|
+
"publint": "^0.2.7",
|
|
159
|
+
"release-it": "^17.0.1",
|
|
160
|
+
"tsd": "^0.30.1",
|
|
161
|
+
"tsup": "^8.0.1",
|
|
162
|
+
"typescript": "^5.3.3",
|
|
163
|
+
"vite-tsconfig-paths": "^4.2.2",
|
|
164
|
+
"vitest": "^1.1.0"
|
|
165
|
+
},
|
|
166
|
+
"githubUrl": "https://github.com/nvie/decoders",
|
|
167
|
+
"sideEffects": false
|
|
105
168
|
}
|
package/result.d.ts
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Result <value> <error>
|
|
3
|
+
* = Ok <value>
|
|
4
|
+
* | Err <error>
|
|
5
|
+
*/
|
|
6
|
+
type Ok<T> = {
|
|
7
|
+
readonly ok: true;
|
|
8
|
+
readonly value: T;
|
|
9
|
+
readonly error?: never;
|
|
10
|
+
};
|
|
11
|
+
type Err<E> = {
|
|
12
|
+
readonly ok: false;
|
|
13
|
+
readonly value?: never;
|
|
14
|
+
readonly error: E;
|
|
15
|
+
};
|
|
16
|
+
type Result<T, E> = Ok<T> | Err<E>;
|
|
17
|
+
/**
|
|
18
|
+
* Create a new Result instance representing a successful computation.
|
|
19
|
+
*/
|
|
20
|
+
declare function ok<T>(value: T): Ok<T>;
|
|
21
|
+
/**
|
|
22
|
+
* Create a new Result instance representing a failed computation.
|
|
23
|
+
*/
|
|
24
|
+
declare function err<E>(error: E): Err<E>;
|
|
6
25
|
|
|
7
|
-
export
|
|
8
|
-
ok: false;
|
|
9
|
-
error: E;
|
|
10
|
-
value?: never;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type Result<T, E> = Ok<T> | Err<E>;
|
|
14
|
-
|
|
15
|
-
export function ok<T>(value: T): Ok<T>;
|
|
16
|
-
export function err<E>(error: E): Err<E>;
|
|
26
|
+
export { type Err, type Ok, type Result, err, ok };
|
package/result.js
CHANGED
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
exports.__esModule = true
|
|
4
|
-
exports.err = err
|
|
5
|
-
exports.ok = ok
|
|
6
3
|
|
|
7
|
-
|
|
8
|
-
return {
|
|
9
|
-
ok: true,
|
|
10
|
-
value: value,
|
|
11
|
-
error: undefined,
|
|
12
|
-
}
|
|
13
|
-
}
|
|
4
|
+
var _chunkBPSZE2VXjs = require('./chunk-BPSZE2VX.js');
|
|
14
5
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
error: error,
|
|
20
|
-
}
|
|
21
|
-
}
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.err = _chunkBPSZE2VXjs.err; exports.ok = _chunkBPSZE2VXjs.ok;
|
|
9
|
+
//# sourceMappingURL=result.js.map
|