Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

75
Views
Coincidencia de casos Camel en package.json

Necesito escribir una tarea en package.json . Se parece a esto:

 "nyc": { "all": true, "include": [ "src/main/**/*.tsx" // here i need to match all camelCase file names ] },

Aquí "src/main/**/*.tsx" necesito hacer coincidir todos los títulos de archivos de camelCase.
ej: corregir "src/main/**/catBlack.tsx" , "src/main/**/carBlack.tsx"
no es correcto "src/main/**/cat.tsx" , "src/main/**/test-file.tsx"
¿Quién puede ayudar?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede crear una función para verificar si una cadena es camelCase usando expresiones regulares

 function isCamelCased(str){ const rgx = new RegExp('[az]{1,}([AZ][az]{1,}){1,}$'); return rgx.test(str); }

es posible que desee crear otra función para eliminar la ruta y la extensión del archivo:

 function getFileName(str){ let file; // remove the path file = str.split('/'); file = file[file.length -1 ]; // remove the extention return file.split('.')[0]; }

Prueba:

 const arr = [ '/main/camelCase.txt', '/main/CamelCase.txt', '/camel.txt', '/main/camel-case.txt', '/main/camel2Case.txt', '/main/camelCase2.txt', '' ] let file; arr.forEach((str) => { file = getFileName(str); console.log(`${file} => ${isCamelCased(file)}`); });

producción:

 "camelCase => true" "CamelCase => true" "camel => false" "camel-case => false" "camel2Case => false" "camelCase2 => false" " '' => false"
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!