Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Commit

Permalink
update /data & /io (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart authored Sep 1, 2023
1 parent 376fc3d commit da52c2b
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 58 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-poets-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@effect/schema": minor
---

update /data & /io
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
"fast-check": "^3.12.0"
},
"peerDependencies": {
"@effect/data": "^0.17.1",
"@effect/io": "^0.38.0"
"@effect/data": "^0.18.3",
"@effect/io": "^0.39.0"
},
"devDependencies": {
"@babel/cli": "^7.22.9",
Expand All @@ -74,12 +74,12 @@
"@changesets/changelog-github": "^0.4.8",
"@changesets/cli": "^2.26.2",
"@definitelytyped/dtslint": "^0.0.165",
"@effect/build-utils": "^0.1.3",
"@effect/data": "^0.17.1",
"@effect/docgen": "^0.1.3",
"@effect/build-utils": "^0.1.4",
"@effect/data": "^0.18.3",
"@effect/docgen": "^0.1.4",
"@effect/eslint-plugin": "^0.1.2",
"@effect/io": "^0.38.0",
"@effect/language-service": "^0.0.19",
"@effect/io": "^0.39.0",
"@effect/language-service": "^0.0.21",
"@types/benchmark": "^2.1.2",
"@types/chai": "^4.3.5",
"@types/glob": "^8.1.0",
Expand Down
126 changes: 84 additions & 42 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ export const brand = <B extends string | symbol, A>(
validateEither(input),
(e) => [{ meta: input, message: formatErrors(e.errors) }]
),
refine: (input: unknown): input is A & Brand<B> => is(input),
is: (input: unknown): input is A & Brand<B> => is(input),
pipe() {
return pipeArguments(this, arguments)
}
Expand Down
10 changes: 5 additions & 5 deletions test/Schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ describe.concurrent("Schema", () => {

it("brand/ refine", () => {
const Int = S.string.pipe(S.numberFromString, S.int(), S.brand("Int"))
expect(Int.refine(1)).toEqual(true)
expect(Int.refine(1.2)).toEqual(false)
expect(Int.is(1)).toEqual(true)
expect(Int.is(1.2)).toEqual(false)
})

it("brand/ composition", () => {
Expand All @@ -158,9 +158,9 @@ describe.concurrent("Schema", () => {

const PositiveInt = S.string.pipe(S.numberFromString, int, positive)

expect(PositiveInt.refine(1)).toEqual(true)
expect(PositiveInt.refine(-1)).toEqual(false)
expect(PositiveInt.refine(1.2)).toEqual(false)
expect(PositiveInt.is(1)).toEqual(true)
expect(PositiveInt.is(-1)).toEqual(false)
expect(PositiveInt.is(1.2)).toEqual(false)
})

it("title", () => {
Expand Down
6 changes: 3 additions & 3 deletions test/pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ describe.concurrent(".pipe()", () => {

const PositiveInt = S.string.pipe(S.numberFromString, int, positive)

expect(PositiveInt.refine(1)).toEqual(true)
expect(PositiveInt.refine(-1)).toEqual(false)
expect(PositiveInt.refine(1.2)).toEqual(false)
expect(PositiveInt.is(1)).toEqual(true)
expect(PositiveInt.is(-1)).toEqual(false)
expect(PositiveInt.is(1.2)).toEqual(false)
})
})

0 comments on commit da52c2b

Please sign in to comment.