Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function to validate a string is in C, S, V format #2263

Closed
wants to merge 4 commits into from
Closed

function to validate a string is in C, S, V format #2263

wants to merge 4 commits into from

Conversation

DaveP80
Copy link

@DaveP80 DaveP80 commented Aug 13, 2023

I made a function that takes a String and returns true or false if the String is CSV formatted. else throw assertString error.

Checklist

  • PR contains only changes related; no stray files, etc.
  • README updated (where applicable)
  • Tests written (where applicable)
  • References provided in PR (where applicable)

src/lib/isCSV.js Fixed Show fixed Hide fixed
src/lib/isCSV.js Fixed Show fixed Hide fixed
src/lib/isCSV.js Fixed Show fixed Hide fixed
@codecov
Copy link

codecov bot commented Aug 13, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (f074abd) 99.95% compared to head (078d07b) 99.95%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2263   +/-   ##
=======================================
  Coverage   99.95%   99.95%           
=======================================
  Files         107      107           
  Lines        2436     2436           
  Branches      615      615           
=======================================
  Hits         2435     2435           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


export default function isCSV(str) {
assertString(str);
const regex = /^(?:\s*[\w\d\s-]+(?:\s*,\s*|$))+$/;

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings containing many repetitions of '\t\t,'.
@profnandaa
Copy link
Member

Thanks for your attempt, but this might not be needed...

@profnandaa profnandaa closed this Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants