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
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/lib/isCSV.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import assertString from './util/assertString';

export default function isCSV(str) {
assertString(str);

Check failure on line 4 in src/lib/isCSV.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 14

Expected indentation of 2 spaces but found 4

Check failure on line 4 in src/lib/isCSV.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 12

Expected indentation of 2 spaces but found 4

Check failure on line 4 in src/lib/isCSV.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 10

Expected indentation of 2 spaces but found 4

Check failure on line 4 in src/lib/isCSV.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 8

Expected indentation of 2 spaces but found 4
const regex = /^(?:\s*[\w\d\s-]+(?:\s*,\s*|$))+$/;

Check failure on line 5 in src/lib/isCSV.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 14

Expected indentation of 2 spaces but found 4

Check failure on line 5 in src/lib/isCSV.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 12

Expected indentation of 2 spaces but found 4

Check failure on line 5 in src/lib/isCSV.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 10

Expected indentation of 2 spaces but found 4

Check failure on line 5 in src/lib/isCSV.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 8

Expected indentation of 2 spaces but found 4
Fixed Show fixed Hide fixed
return regex.test(str);

Check failure on line 6 in src/lib/isCSV.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 14

Expected indentation of 2 spaces but found 4

Check failure on line 6 in src/lib/isCSV.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 12

Expected indentation of 2 spaces but found 4

Check failure on line 6 in src/lib/isCSV.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 10

Expected indentation of 2 spaces but found 4

Check failure on line 6 in src/lib/isCSV.js

View workflow job for this annotation

GitHub Actions / Run tests on Node.js 8

Expected indentation of 2 spaces but found 4
}
Loading