Skip to content

Commit

Permalink
feat: special case BSD* to allow match with BSD
Browse files Browse the repository at this point in the history
Special case BSD* to allow match with BSD
as regex match does not allow special regex chars
at end of licence.

Signed-off-by: Michael Dawson <[email protected]>
  • Loading branch information
mhdawson committed Oct 20, 2022
1 parent 0fb4c61 commit 0e38345
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/lib/regex.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ const escapeRegExp = (string) => {

// 'MIT OR Apache.2.0'.match('MIT')
const matchLicenses = (license, target) => {
// allow BSD* to match BSD
if (license === 'BSD*') license = 'BSD';

const filter = new RegExp(`\\b${escapeRegExp(target)}\\b`);
const match = Array.isArray(license)
? license.join(' OR ').match(filter)
Expand Down

0 comments on commit 0e38345

Please sign in to comment.