0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-07 22:52:39 +00:00

replace _.reduce() with _.forEach()

This commit is contained in:
Gazook89
2021-11-08 08:59:30 -06:00
parent 9141b93a6b
commit c3e24ef4c5

View File

@@ -114,7 +114,7 @@ const Editor = createClass({
let editorPageCount = 2; // start counting from page 2 let editorPageCount = 2; // start counting from page 2
const lineNumbers = _.reduce(this.props.brew.text.split('\n'), (r, line, lineNumber)=>{ _.forEach(this.props.brew.text.split('\n'), (line, lineNumber)=>{
if(this.props.renderer == 'legacy') { if(this.props.renderer == 'legacy') {
if(line.includes('\\page')) { if(line.includes('\\page')) {
const testElement = Object.assign(document.createElement('div'), { const testElement = Object.assign(document.createElement('div'), {
@@ -125,7 +125,6 @@ const Editor = createClass({
testElement.style.top = `${parseInt(testElement.style.top) - 12.5}px`; testElement.style.top = `${parseInt(testElement.style.top) - 12.5}px`;
testElement.style.left = 'unset'; testElement.style.left = 'unset';
editorPageCount = editorPageCount + 1; editorPageCount = editorPageCount + 1;
r.push(lineNumber);
} }
} }
@@ -139,12 +138,9 @@ const Editor = createClass({
testElement.style.top = `${parseInt(testElement.style.top) - 12.5}px`; testElement.style.top = `${parseInt(testElement.style.top) - 12.5}px`;
testElement.style.left = 'unset'; testElement.style.left = 'unset';
editorPageCount = editorPageCount + 1; editorPageCount = editorPageCount + 1;
r.push(lineNumber);
} }
} }
return r; }, [])
}, []);
return lineNumbers;
} }
}, },