From 6299b84c11e5d1fe79fa538df8935018c7613747 Mon Sep 17 00:00:00 2001 From: Leo Conforti Date: Sun, 31 Dec 2023 12:28:28 -0600 Subject: [PATCH] Uncommented linesIterator string function (#1798) --- .changeset/warm-zoos-doubt.md | 5 +++++ packages/effect/src/String.ts | 2 +- packages/effect/test/String.test.ts | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .changeset/warm-zoos-doubt.md diff --git a/.changeset/warm-zoos-doubt.md b/.changeset/warm-zoos-doubt.md new file mode 100644 index 0000000000..e3d7111d7c --- /dev/null +++ b/.changeset/warm-zoos-doubt.md @@ -0,0 +1,5 @@ +--- +"effect": patch +--- + +Uncommented linesIterator string function diff --git a/packages/effect/src/String.ts b/packages/effect/src/String.ts index 2c486a0184..02ae70760c 100644 --- a/packages/effect/src/String.ts +++ b/packages/effect/src/String.ts @@ -576,7 +576,7 @@ const LF = 0x0a * * @since 2.0.0 */ -// export const linesIterator = (self: string): LinesIterator => linesSeparated(self, true) +export const linesIterator = (self: string): LinesIterator => linesSeparated(self, true) /** * Returns an `IterableIterator` which yields each line contained within the diff --git a/packages/effect/test/String.test.ts b/packages/effect/test/String.test.ts index 888718af1c..f654f5a9ed 100644 --- a/packages/effect/test/String.test.ts +++ b/packages/effect/test/String.test.ts @@ -272,4 +272,12 @@ describe("String", () => { deepStrictEqual(Array.from(result), ["\n", "$\n", " $Hello,\r\n", " $World!\n", " $"]) }) }) + + describe("linesIterator", () => { + it("should split a string into lines", () => { + const string = "\n$\n $Hello,\r\n $World!\n $" + const result = S.linesIterator(string) + deepStrictEqual(Array.from(result), ["", "$", " $Hello,", " $World!", " $"]) + }) + }) })