get-reading-time 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -2
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ yarn add get-reading-time
|
|
|
39
39
|
|
|
40
40
|
Here’s how you can use the analyzeText function to analyze a piece of text:
|
|
41
41
|
```bash
|
|
42
|
-
import
|
|
42
|
+
import { analyzeText } from "get-reading-time/dist/index.js";
|
|
43
43
|
```
|
|
44
44
|
// Example input text
|
|
45
45
|
```javascript
|
|
@@ -47,7 +47,22 @@ const text = "This is an example of text. It contains words, sentences, and lin
|
|
|
47
47
|
|
|
48
48
|
const result = analyzeText(text);
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
// Analyze the text
|
|
51
|
+
try {
|
|
52
|
+
const result = analyzeText(text);
|
|
53
|
+
|
|
54
|
+
// Output the analysis results
|
|
55
|
+
console.log("Text Analysis Result:");
|
|
56
|
+
console.log(JSON.stringify(result, null, 2));
|
|
57
|
+
} catch (error) {
|
|
58
|
+
// Narrow the type of error to Error
|
|
59
|
+
if (error instanceof Error) {
|
|
60
|
+
console.error("Error analyzing text:", error.message);
|
|
61
|
+
} else {
|
|
62
|
+
console.error("Unknown error:", error);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
51
66
|
```
|
|
52
67
|
### Example Output
|
|
53
68
|
```json
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "get-reading-time",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"main": "/dist/index.js",
|
|
5
5
|
"module": "/dist/index.mjs",
|
|
6
6
|
"types": "/dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsup",
|
|
9
|
-
"start": "node dist/test.js"
|
|
9
|
+
"start": "node dist/test.js",
|
|
10
|
+
"lint": "tsc",
|
|
11
|
+
"prepare": "npm run build"
|
|
10
12
|
},
|
|
11
13
|
"repository": {
|
|
12
14
|
"type": "git",
|