Skip to content

Commit

Permalink
feat: add 50, 64, 80, 100 character strings (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
enricopolanski authored May 14, 2024
1 parent 7fbdd50 commit 2a6ef89
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions packages/schema/src/moreStrings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,68 @@ export const NonEmptyString50 = NonEmptyString.pipe(
withDefaultMake
)

/**
* A string that is at least 1 character long and a maximum of 64.
*/
export interface NonEmptyString64Brand extends Simplify<B.Brand<"NonEmptyString64"> & NonEmptyString255Brand> {}

/**
* A string that is at least 1 character long and a maximum of 64.
*/
export type NonEmptyString64 = string & NonEmptyString64Brand

/**
* A string that is at least 1 character long and a maximum of 64.
*/
export const NonEmptyString64 = NonEmptyString.pipe(
S.maxLength(64),
fromBrand(nominal<NonEmptyString2k>(), { identifier: "NonEmptyString64", title: "NonEmptyString64", jsonSchema: {} }),
withDefaultMake
)

/**
* A string that is at least 1 character long and a maximum of 80.
*/
export interface NonEmptyString80Brand extends Simplify<B.Brand<"NonEmptyString80"> & NonEmptyString255Brand> {}

/**
* A string that is at least 1 character long and a maximum of 80.
*/
export type NonEmptyString80 = string & NonEmptyString80Brand

/**
* A string that is at least 1 character long and a maximum of 80.
*/

export const NonEmptyString80 = NonEmptyString.pipe(
S.maxLength(80),
fromBrand(nominal<NonEmptyString2k>(), { identifier: "NonEmptyString80", title: "NonEmptyString80", jsonSchema: {} }),
withDefaultMake
)

/**
* A string that is at least 1 character long and a maximum of 100.
*/
export interface NonEmptyString100Brand extends Simplify<B.Brand<"NonEmptyString100"> & NonEmptyString255Brand> {}

/**
* A string that is at least 1 character long and a maximum of 100.
*/
export type NonEmptyString100 = string & NonEmptyString100Brand

/**
* A string that is at least 1 character long and a maximum of 100.
*/
export const NonEmptyString100 = NonEmptyString.pipe(
S.maxLength(100),
fromBrand(nominal<NonEmptyString2k>(), {
identifier: "NonEmptyString100",
title: "NonEmptyString100",
jsonSchema: {}
}),
withDefaultMake
)

/**
* A string that is at least 3 character long and a maximum of 255.
*/
Expand Down

0 comments on commit 2a6ef89

Please sign in to comment.