Skip to content

Commit 9f8b7f1

Browse files
authored
Merge pull request #277 from pascalre/remove-unused-function-10904663719417794338
🧹 Remove unused function `addNewLineBeforeRootKeywords`
2 parents 26c9fe4 + 07cc915 commit 9f8b7f1

2 files changed

Lines changed: 0 additions & 23 deletions

File tree

src/lib.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,3 @@ export function removeLeadingLineBreakOfFirstElement(delimiters: RegExpMatchArra
2828
return delimiters
2929
}
3030

31-
/**
32-
* Add a new line before each occurence of a top level keyword after a new line
33-
* @param {string} text Text to be processed
34-
* @returns {string} processed text
35-
*/
36-
export function addNewLineBeforeRootKeywords(text: string): string {
37-
return text.replace(/\n[^\s]*:/g, "\n$&")
38-
}

src/test/suite/lib.test.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { equal, throws} from "assert"
22

33
import {
4-
addNewLineBeforeRootKeywords,
54
prependWhitespacesOnEachLine
65
} from "../../lib"
76
import { removeTrailingCharacters } from "../../util/yaml-util"
@@ -52,17 +51,3 @@ suite("Test prependWhitespacesOnEachLine", () => {
5251
})
5352
})
5453

55-
suite("Test addNewLineBeforeRootKeywords", () => {
56-
test("should add an empty line before each top level keyword, but only if they appear after a new line", () => {
57-
const actual = `data:
58-
key: value
59-
spec: value
60-
`
61-
const expected = `data:
62-
key: value
63-
64-
spec: value
65-
`
66-
equal(addNewLineBeforeRootKeywords(actual), expected)
67-
})
68-
})

0 commit comments

Comments
 (0)