This lesson just does a little housecleaning after finishing the word game. We clean up the imports and organize the operators.
John Lindquist: [0:00] Now that all of the bugs are squashed and everything's in a great state, let's do some cleanup, so I'm going to grab init and then combine and log. These three, put them in our operators, scroll down at the bottom here, paste them here, and export all of them and make sure to import them from our operators, so init and log and then combine.
[0:35] We don't need mapBroadcaster or combine here. We also don't need share here anymore since there's only a single getWord broadcaster, which doesn't need to be shared to multiple listeners, so we'll get rid of this.
[0:50] I even see right here, I like this as its own operator, so I'm going to go into operators and export a repeat if and paste this where this is a condition. This can take a condition and then we can pipe these together.
[1:17] I just have to make sure that pipe is imported off of lodash/fp, so lodash/fp, and we can bring in repeat if and drop that into our game logic and paste the condition. One of the greatest parts about operators is the ability just to create new ones by piping a couple of them together.
[1:43] Let's clean up the imports again, so done if is gone, repeat is gone. You don't need this URL sitting around. I even like to extract functions like this, where this can be the repeat logic, paste that there, and say "Repeat logic here."
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!