Open
Description
Describe the bug
When setting a RegExp in the list of topics to subscribe to, and that regular expression has the global flag set. The output of the list of topics to subscribe to become indeterministic
To Reproduce
Here is a sample of topics and a regex that produce the problem
const topics = [
"affiliate-AffiliateCreated",
"payment-PaymentCreated",
"products-ProductCreated",
"booking-BookingCreated",
"auth-UserCreated",
"shop-ShopCreated",
"wallet-TransactionCreated",
"auth-UserNewSessionCreated",
"comments-CommentCreated",
"works-WorkCreated",
"landing-page-LandingPageBannerItemCreated",
"booking-AvailabilityCreated",
"queue-QueueCreated",
"blogs-BlogCreated",
"categories-CategoriesCreated",
"auth-UserCreatedNewSession",
"auth-ClientCreated"
]
let rg = /(.*)(Created)(.*)/gi
console.log(topics.filter(topic=> rg.test(topic))
Expected behavior
It is supposed to return the same array.
Environment:
NodeJS 18..
Additional context
The description of the problem
Metadata
Metadata
Assignees
Labels
No labels