Monday 5 June 2017

Compare files names regardless of extension in node

So I have a node script that currently spits out two arrays:

$ yarn run header:test
yarn run v0.22.0
$ ./bin/create_header.js 
[ 'LucidEventIcon.md', 'LucidStates.md' ] [ 'LucidEventIcon.js', 'LucidStates.js' ]

What I would like to do is use some kind of find method to say:

"LucideEventIcon.md should match the LucidEventIcon.js", what I care about is matching on name. I need to keep the file extension so I can, later, prepend the contends of the .md to the .js

How can I match on name, regardless of extension? while looping over the first and checking the second array?

Expected result should be true for both elements in the first array, they should match to the two JS files in the second array.



via TheWebs

No comments:

Post a Comment