Skip to content
This repository has been archived by the owner on Oct 30, 2022. It is now read-only.

Commit

Permalink
Favor String#startsWith() over regex with ^
Browse files Browse the repository at this point in the history
  • Loading branch information
k4m4 committed Dec 7, 2019
1 parent 0fb39d7 commit 3bc2848
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const generateFakerData = (topic, subtopic) => {
const parsePayload = payload => {
let topic, subtopic
payload = String(payload)
if (/^fake/.test(payload)) {
if (payload.startsWith('fake')) {
topic = 'fake'
subtopic = payload.split(topic)[1]
} else {
Expand Down

0 comments on commit 3bc2848

Please sign in to comment.