@effect/schema
Advanced tools
Comparing version 0.17.4 to 0.17.5
{ | ||
"name": "@effect/schema", | ||
"version": "0.17.4", | ||
"version": "0.17.5", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -1469,9 +1469,7 @@ <h3 align="center"> | ||
// add a constraint to the schema, only non-empty strings are valid | ||
S.nonEmpty, | ||
// add an error message for empty strings (annotation) | ||
S.message(() => "required"), | ||
// and add an error message for empty strings (annotation) | ||
S.nonEmpty({ message: () => "required" }), | ||
// add a constraint to the schema, only strings with a length less or equal than 10 are valid | ||
S.maxLength(10), | ||
// add an error message for strings that are too long (annotation) | ||
S.message((s) => `${s} is too long`), | ||
// and add an error message for strings that are too long (annotation) | ||
S.maxLength(10, { message: (s) => `${s} is too long` }), | ||
// add an identifier to the schema (annotation) | ||
@@ -1478,0 +1476,0 @@ S.identifier("Password"), |
@@ -314,3 +314,3 @@ /** | ||
*/ | ||
export declare const pick: <A, Keys extends readonly (keyof A)[]>(...keys: Keys) => <I extends { [K in keyof A]: any; }>(self: Schema<I, A>) => Schema<Spread<Pick<I, Keys[number]>>, Spread<Pick<A, Keys[number]>>>; | ||
export declare const pick: <A, Keys extends readonly (keyof A)[]>(...keys: Keys) => <I extends { [K in keyof A]?: any; }>(self: Schema<I, A>) => Schema<Spread<Pick<I, Keys[number]>>, Spread<Pick<A, Keys[number]>>>; | ||
/** | ||
@@ -320,3 +320,3 @@ * @category combinators | ||
*/ | ||
export declare const omit: <A, Keys extends readonly (keyof A)[]>(...keys: Keys) => <I extends { [K in keyof A]: any; }>(self: Schema<I, A>) => Schema<Spread<Omit<I, Keys[number]>>, Spread<Omit<A, Keys[number]>>>; | ||
export declare const omit: <A, Keys extends readonly (keyof A)[]>(...keys: Keys) => <I extends { [K in keyof A]?: any; }>(self: Schema<I, A>) => Schema<Spread<Omit<I, Keys[number]>>, Spread<Omit<A, Keys[number]>>>; | ||
/** | ||
@@ -323,0 +323,0 @@ * Returns an object containing all property signatures of a given schema. |
@@ -472,3 +472,9 @@ "use strict"; | ||
exports.struct = struct; | ||
const pick = (...keys) => self => make(AST.pick(self.ast, keys)); | ||
const pick = (...keys) => self => { | ||
const ast = self.ast; | ||
if (AST.isTransform(ast) && ast.propertySignatureTransformations.length > 0) { | ||
return make(AST.createTransformByPropertySignatureTransformations(AST.pick(ast.from, keys), AST.pick(ast.to, keys), ast.propertySignatureTransformations.filter(t => keys.includes(t.to)))); | ||
} | ||
return make(AST.pick(ast, keys)); | ||
}; | ||
/** | ||
@@ -479,3 +485,9 @@ * @category combinators | ||
exports.pick = pick; | ||
const omit = (...keys) => self => make(AST.omit(self.ast, keys)); | ||
const omit = (...keys) => self => { | ||
const ast = self.ast; | ||
if (AST.isTransform(ast) && ast.propertySignatureTransformations.length > 0) { | ||
return make(AST.createTransformByPropertySignatureTransformations(AST.omit(ast.from, keys), AST.omit(ast.to, keys), ast.propertySignatureTransformations.filter(t => !keys.includes(t.to)))); | ||
} | ||
return make(AST.omit(ast, keys)); | ||
}; | ||
/** | ||
@@ -482,0 +494,0 @@ * Returns an object containing all property signatures of a given schema. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
917565
17584
1543