Skip to content

Commit

Permalink
rename Config.stringNonEmpty to nonEmptyString (#3517)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Aug 30, 2024
1 parent e557838 commit 200e9d3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
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

0 comments on commit 200e9d3

Please sign in to comment.