Skip to content

Commit

Permalink
Update Readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dy committed Feb 11, 2025
1 parent 5aa4b90 commit 0a2b7bf
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,7 @@ parse('1 hora 20 minutos', 'm') // 80

## Safety

For best performance in sensitive APIs input can be kept short:

```js
const MAX_INPUT_LENGTH = 100;

function safeParse(input) {
if (input.length > MAX_INPUT_LENGTH) {
throw new Error('Input string is too long');
}
return parseDuration(input);
}

safeParse('1hr 20mins'); // => 1 * h + 20 * m
```
For best performance in sensitive APIs make sure input string is reasonably short (under 100 characters).



Expand Down

0 comments on commit 0a2b7bf

Please # to comment.