Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Refactoring to include husky pre-commit hooks, improved eslint rules and manual chunking + more #73

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

Merged
Mathys-Gasnier merged 7 commits into quicksnip-dev:main from barrymun:refactor/linting
Jan 1, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
reverting changes to slugify function to be on the safe side as there...
... are no unit tests yet. seems as if some of the escapes could be removed in the future
  • Loading branch information
barrymun committed Dec 31, 2024
commit 0b78050a9565837e0a2acba7da0b03430937f536
9 changes: 5 additions & 4 deletions src/utils/slugify.ts
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* eslint-disable no-useless-escape */
export const slugify = (string: string, separator = "-") => {
return string
.toString() // Cast to string (optional)
.toLowerCase() // Convert the string to lowercase letters
.trim() // Remove whitespace from both sides of a string (optional)
.replace(/\s+/g, separator) // Replace spaces with {separator}
.replace(/[^\w-]+/g, "") // Remove all non-word chars
.replace(/_/g, separator) // Replace _ with {separator}
.replace(/--+/g, separator) // Replace multiple - with single {separator}
.replace(/-$/g, ""); // Remove trailing -
.replace(/[^\w\-]+/g, "") // Remove all non-word chars
.replace(/\_/g, separator) // Replace _ with {separator}
.replace(/\-\-+/g, separator) // Replace multiple - with single {separator}
.replace(/\-$/g, ""); // Remove trailing -
};

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /