@fraqjs/fraq 0.10.2 → 0.10.3
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.d.mts +2 -0
- package/dist/index.mjs +13 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -5486,6 +5486,8 @@ declare class Parameter<T> {
|
|
|
5486
5486
|
description?: string;
|
|
5487
5487
|
constructor(capturer: Capturer<T>);
|
|
5488
5488
|
describe(description: string): this;
|
|
5489
|
+
refine<U extends T>(predicate: (value: T) => value is U): Parameter<U>;
|
|
5490
|
+
refine(predicate: (value: T) => boolean): Parameter<T>;
|
|
5489
5491
|
}
|
|
5490
5492
|
declare namespace param {
|
|
5491
5493
|
function literal<T extends string>(literal: T): Parameter<T>;
|
package/dist/index.mjs
CHANGED
|
@@ -1229,7 +1229,7 @@ const milkyVersion = "1.3";
|
|
|
1229
1229
|
const milkyPackageVersion = "1.3.0-rc.1";
|
|
1230
1230
|
//#endregion
|
|
1231
1231
|
//#region src/routing/parameter.ts
|
|
1232
|
-
var Parameter = class {
|
|
1232
|
+
var Parameter = class Parameter {
|
|
1233
1233
|
capturer;
|
|
1234
1234
|
description;
|
|
1235
1235
|
constructor(capturer) {
|
|
@@ -1239,6 +1239,18 @@ var Parameter = class {
|
|
|
1239
1239
|
this.description = description;
|
|
1240
1240
|
return this;
|
|
1241
1241
|
}
|
|
1242
|
+
refine(predicate) {
|
|
1243
|
+
const capturer = this.capturer;
|
|
1244
|
+
const refined = new Parameter({
|
|
1245
|
+
typeInstruction: capturer.typeInstruction,
|
|
1246
|
+
capture(tokenizer) {
|
|
1247
|
+
const value = capturer.capture(tokenizer);
|
|
1248
|
+
if (value === void 0 || predicate(value)) return value;
|
|
1249
|
+
}
|
|
1250
|
+
});
|
|
1251
|
+
refined.description = this.description;
|
|
1252
|
+
return refined;
|
|
1253
|
+
}
|
|
1242
1254
|
};
|
|
1243
1255
|
let param;
|
|
1244
1256
|
(function(_param) {
|