Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename Config.stringNonEmpty to nonEmptyString #3517

Merged
merged 1 commit into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
rename Config.stringNonEmpty to nonEmptyString
  • Loading branch information
tim-smart committed Aug 30, 2024
commit 4c71bfc024f59701da7983bfafa2cd1eb378c516
2 changes: 1 addition & 1 deletion .changeset/hot-dogs-mix.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 2,4 @@
"effect": minor
---

New constructor Config.stringNonEmpty
New constructor Config.nonEmptyString
2 changes: 1 addition & 1 deletion packages/effect/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 373,7 @@ export const string: (name?: string) => Config<string> = internal.string
* @since 3.7.0
* @category constructors
*/
export const stringNonEmpty: (name?: string) => Config<string> = internal.stringNonEmpty
export const nonEmptyString: (name?: string) => Config<string> = internal.nonEmptyString

/**
* Constructs a config which contains the specified value.
Expand Down
2 changes: 1 addition & 1 deletion packages/effect/src/internal/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 448,7 @@ export const string = (name?: string): Config.Config<string> => {
}

/** @internal */
export const stringNonEmpty = (name?: string): Config.Config<string> => {
export const nonEmptyString = (name?: string): Config.Config<string> => {
const config = primitive(
"a non-empty text property",
Either.liftPredicate((text) => text.length > 0, () => configError.MissingData([], "Expected a non-empty string"))
Expand Down
6 changes: 3 additions & 3 deletions packages/effect/test/Config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 66,15 @@ describe("Config", () => {
})
})

describe("stringNonEmpty", () => {
describe("nonEmptyString", () => {
it("name = undefined", () => {
const config = Config.array(Config.stringNonEmpty(), "ITEMS")
const config = Config.array(Config.nonEmptyString(), "ITEMS")
assertSuccess(config, [["ITEMS", "foo"]], ["foo"])
assertFailure(config, [["ITEMS", ""]], ConfigError.MissingData(["ITEMS"], "Expected a non-empty string"))
})

it("name != undefined", () => {
const config = Config.stringNonEmpty("NON_EMPTY_STRING")
const config = Config.nonEmptyString("NON_EMPTY_STRING")
assertSuccess(config, [["NON_EMPTY_STRING", "foo"]], "foo")
assertSuccess(config, [["NON_EMPTY_STRING", " "]], " ")
assertFailure(
Expand Down