-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
41 lines (34 loc) · 1.14 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { paragraphsLines } from './paragraphs-lines.js';
import fs from 'fs';
// Input text
const textInput = `
After great pain, a formal feeling comes – (372)
After great pain, a formal feeling comes –
The Nerves sit ceremonious, like Tombs –
The stiff Heart questions ‘was it He, that bore,’
And ‘Yesterday, or Centuries before’?
The Feet, mechanical, go round –
A Wooden way
Of Ground, or Air, or Ought –
Regardless grown,
A Quartz contentment, like a stone –
This is the Hour of Lead –
Remembered, if outlived,
As Freezing persons, recollect the Snow –
First – Chill – then Stupor – then the letting go –
`;
// Process the text content
const processedContent = paragraphsLines(textInput);
// Structure the JSON output
const result = {
text: {
textTitle: processedContent.textTitle,
textData: {
textLineCount: processedContent.textLineCount,
textWordCount: processedContent.textWordCount,
textCharacterLength: processedContent.textCharacterLength,
},
textParagraphs: processedContent.textParagraphs
}
};
console.log(JSON.stringify(result, null, 2));