Skip to content

Commit

Permalink
Uncommented linesIterator string function (#1798)
Browse files Browse the repository at this point in the history
  • Loading branch information
leonitousconforti authored Dec 31, 2023
1 parent c0aeb5e commit 6299b84
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/warm-zoos-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": patch
---

Uncommented linesIterator string function
2 changes: 1 addition & 1 deletion packages/effect/src/String.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions packages/effect/test/String.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!", " $"])
})
})
})

0 comments on commit 6299b84

Please sign in to comment.