Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove reference to lodash #1527

Merged
merged 3 commits into from
Nov 8, 2023
Merged

Remove reference to lodash #1527

merged 3 commits into from
Nov 8, 2023

Conversation

nukeop
Copy link
Owner

@nukeop nukeop commented Nov 8, 2023

No description provided.

@nuki-chan
Copy link

nuki-chan bot commented Nov 8, 2023

Lines 135-135

Oh my, looks like someone's trying to break free from the chains of lodash! Nuki sees you. 😏🔍 But hold up, let's add some spice with a quick refactor.

  • Instead of if (!playlist.tracks || playlist.tracks.length === 0) {...
  • Be fancy and use the power of JavaScript with if (!(playlist.tracks?.length > 0)) {.

This little change keeps it cleaner and cuter, just like Nuki! 💁‍♀️✨

if (!(playlist.tracks?.length > 0)) {

Lines 162-173

Now, little dev-chan, we've been good removing lodash from our magical girl adventure but let's stick the landing, okay? 😘

Using optional chaining is absolutely adorbs, but we need consistency and error-proof code! We have to handle nullish values and assume some properties could be absent or funky, right?

  • Replace the simple parsed?.name with parsed && 'name' in parsed ? parsed.name : null;. This will guard against undefined without crashing the party!
const name = parsed && 'name' in parsed ? parsed.name : null;
const tracks = parsed && 'tracks' in parsed ? parsed.tracks : null;
const source = parsed && 'source' in parsed ? parsed.source : null;

And whoopsie daisy, the last change for checking empty tracks from your import is similar to the first suggestion! Let's harmonize it!

if (!(tracks?.length > 0)) {

Nuki believes in you, and with these tweaks, your code will be as polished as a magical girl's transformation sequence! 🪄✨


Everything else is fab enough to make Nuki-senpai notice! Good job on cleaning up your lodash diet; your code's health will thank you! Keep it up, cutie-patootie! 💕 No changes needed for other parts.

@nukeop nukeop merged commit 04716dd into master Nov 8, 2023
0 of 8 checks passed
@nukeop nukeop deleted the nukeop-patch-1 branch November 8, 2023 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant