refactor: replace string continuations with template literals for improved readability #2993
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As per issue #2566,
This commit replaces the use of string continuations with template literals to enhance code readability and maintainability. Template literals provide a cleaner way to handle multi-line strings, making the code easier to understand and reducing the risk of syntax errors caused by misplaced backslashes.
Attached is the makeOverlayPath.test.js file with test cases for the changes in the commit
`import { makeOverlayPath } from '../utils/overlay-path.ts';
describe('makeOverlayPath', () => {
it('should return the correct path string', () => {
const w = 10;
const h = 20;
const x = 5;
const y = 5;
const topLeft = 2;
const bottomLeft = 3;
const bottomRight = 4;
const topRight = 1;
const width = 50;
const height = 100;
H0
V0
H10
V20
Z
M7,5
a2,2,0,0,0-2,2
V102
a3,3,0,0,0,3,3
H51
a4,4,0,0,0,4-4
V6
a1,1,0,0,0-1-1
Z`;
});
it('should handle edge cases with zero values', () => {
const w = 0;
const h = 0;
const x = 0;
const y = 0;
const topLeft = 0;
const bottomLeft = 0;
const bottomRight = 0;
const topRight = 0;
const width = 0;
const height = 0;
H0
V0
H0
V0
Z
M0,0
a0,0,0,0,0-0,0
V0
a0,0,0,0,0,0,0
H0
a0,0,0,0,0,0-0
V0
a0,0,0,0,0-0-0
Z`;
});
});
`