ItsMeBrianD / Percival

SpaceX Data Aggregator
0 stars 0 forks source link

Use global Regex pattern to replace all spaces #4

Closed jaller94 closed 5 years ago

jaller94 commented 5 years ago

If pattern is a string, only the first occurrence will be replaced. The section header "Type of Object" currently becomes "Typeof Object".

I assume you wanted to remove all spaces. A regular expression can help because it has the global flag g. This matches every space:

/ /g

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace The deprecation warning for flags refers to an unofficial third parameter, not pure regular expressions.

ItsMeBrianD commented 5 years ago

Good change, while that is "technically correct" because it's all integrated in a known way I wasn't too worried about it.