@railway-ts/pipelines 0.1.4 → 0.1.5
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 +10 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +10 -1
- package/dist/index.mjs.map +1 -1
- package/dist/schema/index.cjs +10 -0
- package/dist/schema/index.cjs.map +1 -1
- package/dist/schema/index.d.cts +113 -1
- package/dist/schema/index.d.ts +113 -1
- package/dist/schema/index.mjs +10 -1
- package/dist/schema/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -400,6 +400,15 @@ function refine(predicate, message = "Custom validation failed") {
|
|
|
400
400
|
return ok(value);
|
|
401
401
|
};
|
|
402
402
|
}
|
|
403
|
+
function refineAt(targetPath, predicate, message) {
|
|
404
|
+
return (value, parentPath = []) => {
|
|
405
|
+
if (!predicate(value)) {
|
|
406
|
+
const fieldPath = Array.isArray(targetPath) ? targetPath : [targetPath];
|
|
407
|
+
return err([{ path: [...parentPath, ...fieldPath], message }]);
|
|
408
|
+
}
|
|
409
|
+
return ok(value);
|
|
410
|
+
};
|
|
411
|
+
}
|
|
403
412
|
|
|
404
413
|
// src/schema/string.ts
|
|
405
414
|
function string(message = "Must be a string") {
|
|
@@ -1109,6 +1118,7 @@ exports.pipe = pipe;
|
|
|
1109
1118
|
exports.positive = positive;
|
|
1110
1119
|
exports.precision = precision;
|
|
1111
1120
|
exports.refine = refine;
|
|
1121
|
+
exports.refineAt = refineAt;
|
|
1112
1122
|
exports.required = required;
|
|
1113
1123
|
exports.some = some;
|
|
1114
1124
|
exports.string = string;
|