We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2c0c072 commit 1d61c72Copy full SHA for 1d61c72
Readme.md
@@ -62,4 +62,24 @@ parse.unit = es
62
parse('1 hora 20 minutos', 'm') // 80
63
```
64
65
+
66
+## Security Note
67
68
+To avoid issues with long strings in sensitive APIs, limit input length:
69
70
+```js
71
+const MAX_INPUT_LENGTH = 100;
72
73
+function safeParse(input) {
74
+ if (input.length > MAX_INPUT_LENGTH) {
75
+ throw new Error('Input string is too long');
76
+ }
77
+ return parseDuration(input);
78
+}
79
80
+safeParse('1hr 20mins'); // => 1 * h + 20 * m
81
+```
82
83
84
85
<p align="center"><a href="https://github.com/krishnized/license">ॐ</a></p>
0 commit comments