export async function containsRequireDirective ( requirementsTxt ) { const allMatches = [ ] ; const REQUIRE_PATTERN = new RegExp ( /^[^\S\n]*-(r|c)\s+(.+)/ , 'gm' ) ; const matches = getAllMatchedGroups ( REQUIRE_PATTERN , requirementsTxt ) ; for ( const match of matches ) { if ( match && match . length > 1 ) { allMatches . push ( match ) ; } } return { containsRequire : allMatches . length > 0 , matches : allMatches } ; } function getAllMatchedGroups ( re , str ) { const groups = [ ] ; let match ; while ( ( match = re . exec ( str ) ) ) { groups . push ( match ) ; } return groups ; }