decoders 2.7.4 → 2.8.0-0
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/dist/index.cjs +5 -4
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +4 -3
- package/package.json +17 -17
package/dist/index.cjs
CHANGED
|
@@ -403,8 +403,8 @@ function brand2(decoder) {
|
|
|
403
403
|
_register2.add(decoder);
|
|
404
404
|
return decoder;
|
|
405
405
|
}
|
|
406
|
-
function isDecoder(
|
|
407
|
-
return _register2.has(
|
|
406
|
+
function isDecoder(value) {
|
|
407
|
+
return _register2.has(value);
|
|
408
408
|
}
|
|
409
409
|
|
|
410
410
|
// src/arrays.ts
|
|
@@ -753,7 +753,7 @@ function bySizeOptions(options) {
|
|
|
753
753
|
}
|
|
754
754
|
|
|
755
755
|
// src/strings.ts
|
|
756
|
-
var url_re = /^([A-Za-z]{2,12}(?:[+][A-Za-z]{2,12})?):\/\/(?:([
|
|
756
|
+
var url_re = /^([A-Za-z]{2,12}(?:[+][A-Za-z]{2,12})?):\/\/(?:([^@:]*:?(?:[^@]+)?)@)?(?:([A-Za-z0-9.-]+)(?::([0-9]{2,5}))?)(\/(?:[-+~%/.,\w]*)?(?:\?[-+=&;%@.,/\w]*)?(?:#[.,!/\w]*)?)?$/;
|
|
757
757
|
var string = define(
|
|
758
758
|
(blob, ok2, err2) => isString(blob) ? ok2(blob) : err2("Must be string")
|
|
759
759
|
);
|
|
@@ -935,4 +935,5 @@ var json = either(
|
|
|
935
935
|
|
|
936
936
|
|
|
937
937
|
|
|
938
|
-
|
|
938
|
+
|
|
939
|
+
exports.always = always; exports.anyNumber = anyNumber; exports.array = array; exports.bigint = bigint; exports.boolean = boolean; exports.constant = constant; exports.date = date; exports.dateString = dateString; exports.datelike = datelike; exports.decimal = decimal; exports.define = define; exports.dict = dict; exports.either = either; exports.email = email; exports.endsWith = endsWith; exports.enum_ = enum_; exports.err = err; exports.exact = exact; exports.fail = fail; exports.formatInline = formatInline; exports.formatShort = formatShort; exports.hardcoded = hardcoded; exports.hexadecimal = hexadecimal; exports.httpsUrl = httpsUrl; exports.identifier = identifier; exports.inexact = inexact; exports.instanceOf = instanceOf; exports.integer = integer; exports.isDecoder = isDecoder; exports.iso8601 = iso8601; exports.json = json; exports.jsonArray = jsonArray; exports.jsonObject = jsonObject; exports.lazy = lazy; exports.mapping = mapping; exports.maybe = maybe; exports.mixed = mixed; exports.nanoid = nanoid; exports.never = never; exports.nonEmptyArray = nonEmptyArray; exports.nonEmptyString = nonEmptyString; exports.null_ = null_; exports.nullable = nullable; exports.nullish = nullish; exports.number = number; exports.numeric = numeric; exports.object = object; exports.ok = ok; exports.oneOf = oneOf; exports.optional = optional; exports.poja = poja; exports.pojo = pojo; exports.positiveInteger = positiveInteger; exports.positiveNumber = positiveNumber; exports.prep = prep; exports.record = record; exports.regex = regex; exports.select = select; exports.set = set; exports.setFromArray = setFromArray; exports.startsWith = startsWith; exports.string = string; exports.taggedUnion = taggedUnion; exports.truthy = truthy; exports.tuple = tuple; exports.undefined_ = undefined_; exports.unknown = unknown; exports.url = url; exports.uuid = uuid; exports.uuidv1 = uuidv1; exports.uuidv4 = uuidv4;
|
package/dist/index.d.cts
CHANGED
|
@@ -208,6 +208,10 @@ type DecoderType<D extends Decoder<any>> = D extends Decoder<infer T> ? T : neve
|
|
|
208
208
|
* effects! You'll need to _return_ those values.
|
|
209
209
|
*/
|
|
210
210
|
declare function define<T>(fn: AcceptanceFn<T>): Decoder<T>;
|
|
211
|
+
/**
|
|
212
|
+
* Returns whether the given value is a Decoder instance.
|
|
213
|
+
*/
|
|
214
|
+
declare function isDecoder(value: unknown): value is Decoder<unknown>;
|
|
211
215
|
|
|
212
216
|
type Formatter = (err: Annotation) => string | Error;
|
|
213
217
|
declare function formatInline(ann: Annotation): string;
|
|
@@ -668,4 +672,4 @@ declare function taggedUnion<O extends Record<string, Decoder<unknown>>>(field:
|
|
|
668
672
|
*/
|
|
669
673
|
declare function select<T, D extends Decoder<unknown>>(scout: Decoder<T>, selectFn: (result: T) => D): Decoder<DecoderType<D>>;
|
|
670
674
|
|
|
671
|
-
export { type DecodeResult, type Decoder, type DecoderType, type Err, type Formatter, type JSONArray, type JSONObject, type JSONValue, type Ok, type Result, type Scalar, type SizeOptions, always, anyNumber, array, bigint, boolean, constant, date, dateString, datelike, decimal, define, dict, either, email, endsWith, enum_, err, exact, fail, formatInline, formatShort, hardcoded, hexadecimal, httpsUrl, identifier, inexact, instanceOf, integer, iso8601, json, jsonArray, jsonObject, lazy, mapping, maybe, mixed, nanoid, never, nonEmptyArray, nonEmptyString, null_, nullable, nullish, number, numeric, object, ok, oneOf, optional, poja, pojo, positiveInteger, positiveNumber, prep, record, regex, select, set, setFromArray, startsWith, string, taggedUnion, truthy, tuple, undefined_, unknown, url, uuid, uuidv1, uuidv4 };
|
|
675
|
+
export { type DecodeResult, type Decoder, type DecoderType, type Err, type Formatter, type JSONArray, type JSONObject, type JSONValue, type Ok, type Result, type Scalar, type SizeOptions, always, anyNumber, array, bigint, boolean, constant, date, dateString, datelike, decimal, define, dict, either, email, endsWith, enum_, err, exact, fail, formatInline, formatShort, hardcoded, hexadecimal, httpsUrl, identifier, inexact, instanceOf, integer, isDecoder, iso8601, json, jsonArray, jsonObject, lazy, mapping, maybe, mixed, nanoid, never, nonEmptyArray, nonEmptyString, null_, nullable, nullish, number, numeric, object, ok, oneOf, optional, poja, pojo, positiveInteger, positiveNumber, prep, record, regex, select, set, setFromArray, startsWith, string, taggedUnion, truthy, tuple, undefined_, unknown, url, uuid, uuidv1, uuidv4 };
|
package/dist/index.d.ts
CHANGED
|
@@ -208,6 +208,10 @@ type DecoderType<D extends Decoder<any>> = D extends Decoder<infer T> ? T : neve
|
|
|
208
208
|
* effects! You'll need to _return_ those values.
|
|
209
209
|
*/
|
|
210
210
|
declare function define<T>(fn: AcceptanceFn<T>): Decoder<T>;
|
|
211
|
+
/**
|
|
212
|
+
* Returns whether the given value is a Decoder instance.
|
|
213
|
+
*/
|
|
214
|
+
declare function isDecoder(value: unknown): value is Decoder<unknown>;
|
|
211
215
|
|
|
212
216
|
type Formatter = (err: Annotation) => string | Error;
|
|
213
217
|
declare function formatInline(ann: Annotation): string;
|
|
@@ -668,4 +672,4 @@ declare function taggedUnion<O extends Record<string, Decoder<unknown>>>(field:
|
|
|
668
672
|
*/
|
|
669
673
|
declare function select<T, D extends Decoder<unknown>>(scout: Decoder<T>, selectFn: (result: T) => D): Decoder<DecoderType<D>>;
|
|
670
674
|
|
|
671
|
-
export { type DecodeResult, type Decoder, type DecoderType, type Err, type Formatter, type JSONArray, type JSONObject, type JSONValue, type Ok, type Result, type Scalar, type SizeOptions, always, anyNumber, array, bigint, boolean, constant, date, dateString, datelike, decimal, define, dict, either, email, endsWith, enum_, err, exact, fail, formatInline, formatShort, hardcoded, hexadecimal, httpsUrl, identifier, inexact, instanceOf, integer, iso8601, json, jsonArray, jsonObject, lazy, mapping, maybe, mixed, nanoid, never, nonEmptyArray, nonEmptyString, null_, nullable, nullish, number, numeric, object, ok, oneOf, optional, poja, pojo, positiveInteger, positiveNumber, prep, record, regex, select, set, setFromArray, startsWith, string, taggedUnion, truthy, tuple, undefined_, unknown, url, uuid, uuidv1, uuidv4 };
|
|
675
|
+
export { type DecodeResult, type Decoder, type DecoderType, type Err, type Formatter, type JSONArray, type JSONObject, type JSONValue, type Ok, type Result, type Scalar, type SizeOptions, always, anyNumber, array, bigint, boolean, constant, date, dateString, datelike, decimal, define, dict, either, email, endsWith, enum_, err, exact, fail, formatInline, formatShort, hardcoded, hexadecimal, httpsUrl, identifier, inexact, instanceOf, integer, isDecoder, iso8601, json, jsonArray, jsonObject, lazy, mapping, maybe, mixed, nanoid, never, nonEmptyArray, nonEmptyString, null_, nullable, nullish, number, numeric, object, ok, oneOf, optional, poja, pojo, positiveInteger, positiveNumber, prep, record, regex, select, set, setFromArray, startsWith, string, taggedUnion, truthy, tuple, undefined_, unknown, url, uuid, uuidv1, uuidv4 };
|
package/dist/index.js
CHANGED
|
@@ -403,8 +403,8 @@ function brand2(decoder) {
|
|
|
403
403
|
_register2.add(decoder);
|
|
404
404
|
return decoder;
|
|
405
405
|
}
|
|
406
|
-
function isDecoder(
|
|
407
|
-
return _register2.has(
|
|
406
|
+
function isDecoder(value) {
|
|
407
|
+
return _register2.has(value);
|
|
408
408
|
}
|
|
409
409
|
|
|
410
410
|
// src/arrays.ts
|
|
@@ -753,7 +753,7 @@ function bySizeOptions(options) {
|
|
|
753
753
|
}
|
|
754
754
|
|
|
755
755
|
// src/strings.ts
|
|
756
|
-
var url_re = /^([A-Za-z]{2,12}(?:[+][A-Za-z]{2,12})?):\/\/(?:([
|
|
756
|
+
var url_re = /^([A-Za-z]{2,12}(?:[+][A-Za-z]{2,12})?):\/\/(?:([^@:]*:?(?:[^@]+)?)@)?(?:([A-Za-z0-9.-]+)(?::([0-9]{2,5}))?)(\/(?:[-+~%/.,\w]*)?(?:\?[-+=&;%@.,/\w]*)?(?:#[.,!/\w]*)?)?$/;
|
|
757
757
|
var string = define(
|
|
758
758
|
(blob, ok2, err2) => isString(blob) ? ok2(blob) : err2("Must be string")
|
|
759
759
|
);
|
|
@@ -893,6 +893,7 @@ export {
|
|
|
893
893
|
inexact,
|
|
894
894
|
instanceOf,
|
|
895
895
|
integer,
|
|
896
|
+
isDecoder,
|
|
896
897
|
iso8601,
|
|
897
898
|
json,
|
|
898
899
|
jsonArray,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "decoders",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0-0",
|
|
4
4
|
"description": "Elegant and battle-tested validation library for type-safe input data for TypeScript",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -60,27 +60,27 @@
|
|
|
60
60
|
"verify"
|
|
61
61
|
],
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@arethetypeswrong/cli": "^0.
|
|
64
|
-
"@eslint/js": "^9.
|
|
63
|
+
"@arethetypeswrong/cli": "^0.18.2",
|
|
64
|
+
"@eslint/js": "^9.35.0",
|
|
65
65
|
"@release-it/keep-a-changelog": "^7.0.0",
|
|
66
66
|
"@standard-schema/spec": "^1.0.0",
|
|
67
|
-
"@vitest/coverage-istanbul": "^3.
|
|
68
|
-
"eslint": "^9.
|
|
69
|
-
"eslint-plugin-import": "^2.
|
|
67
|
+
"@vitest/coverage-istanbul": "^3.2.4",
|
|
68
|
+
"eslint": "^9.35.0",
|
|
69
|
+
"eslint-plugin-import": "^2.32.0",
|
|
70
70
|
"eslint-plugin-simple-import-sort": "^12.1.1",
|
|
71
|
-
"fast-check": "^4.
|
|
72
|
-
"itertools": "^2.
|
|
73
|
-
"pkg-pr-new": "^0.0.
|
|
74
|
-
"prettier": "^3.
|
|
75
|
-
"publint": "^0.3.
|
|
71
|
+
"fast-check": "^4.3.0",
|
|
72
|
+
"itertools": "^2.5.0",
|
|
73
|
+
"pkg-pr-new": "^0.0.60",
|
|
74
|
+
"prettier": "^3.6.2",
|
|
75
|
+
"publint": "^0.3.12",
|
|
76
76
|
"release-it": "^19.0.4",
|
|
77
|
-
"ts-morph": "^
|
|
78
|
-
"tsd": "^0.
|
|
79
|
-
"tsup": "^8.
|
|
80
|
-
"typescript": "^5.
|
|
81
|
-
"typescript-eslint": "^8.
|
|
77
|
+
"ts-morph": "^27.0.0",
|
|
78
|
+
"tsd": "^0.33.0",
|
|
79
|
+
"tsup": "^8.5.0",
|
|
80
|
+
"typescript": "^5.9.2",
|
|
81
|
+
"typescript-eslint": "^8.44.0",
|
|
82
82
|
"vite-tsconfig-paths": "^5.1.4",
|
|
83
|
-
"vitest": "^3.
|
|
83
|
+
"vitest": "^3.2.4"
|
|
84
84
|
},
|
|
85
85
|
"githubUrl": "https://github.com/nvie/decoders",
|
|
86
86
|
"sideEffects": false
|