question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lib should error instead of stripping invalid characters

See original GitHub issue

I found an issue where ‘123.sd’ is turned into ‘123.00’. I was expecting this to error out as it is not a valid currency value. Looking at the code I found the following test. Any insights of what is the logic of such functionality?

If the functionality has come valid case, would it be possible to have a flag that will make this case error out?

test('should strip invalid characters', t => {
  var str = currency('a1b2c3');
  t.is(parseFloat(str), 123, 'currency("a1b2c3") is 123');
});

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
scurkercommented, Mar 14, 2019

@ericvera I think a having strictInput or strict mode actually sounds reasonable. I need to think about what that means in relation to errorOnInvalid but that’s something that could potentially be released with a 2.0 version of the library.

0reactions
osddeitfcommented, Oct 23, 2021

it’s v2.0.4 as of now, shouldn’t this be implemented?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Character causes invalid character error · Issue #147 - GitHub
Providing a utility to strip the characters out would be an even worse option, as this would change the meaning of the data....
Read more >
Stripping Invalid XML characters in Java - Stack Overflow
I used Xalan org.apache.xml.utils.XMLChar class: public static String stripInvalidXmlCharacters(String input) { StringBuilder sb = new ...
Read more >
invalid characters - Constant Contact Community - 381042
If you're receiving that error, try removing spaces and any other non-alphanumeric symbols from your file's name before importing to the ...
Read more >
8.25. Strip Invalid Characters from Filenames - O'Reilly
Strip Invalid Characters from Filenames Problem You want to strip a string of characters that aren't valid in Windows filenames.
Read more >
How do I get rid of invalid characters error? - SAS Communities
It's going to be a character variable. Start by reducing proc report and removing half the character variables and running it. If it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found