JS RegExp assertion

Chai Tea

Today I found out that this

array1[0] = /[a-z]/ 
array2[0] = /[a-z]/
array[0] === array[1]

is false.

My suggestion to test a JS RexExp assertion is

array1.forEach((value, i) => {
if (value instanceof RegExp) {
expect(value[‘source’]).to.equal(array2[i][‘source’])
}
})

Let me know what you think.

Like what you read? Give Jorge Ortega a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.