simov / simov/slugify

Using "remove" option might introduce untransliterated symbols

Open
#65 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.7k
Forks
142
PR merge metrics
No merged PRs in 30d

Description

const slugify = require('slugify');
console.log(slugify('Аленький цветочек'));  // Alenkij-cvetochek
console.log(slugify('Аленький цветочек', {remove: /[()]+/g}));  // Alenьkij-cvetochek

That happens because slugify first removes the symbol, but then right away adds it back:

(charMap[ch] || ch).replace(options.remove || /[^\w\s$*_+~.()'"!\-:@]/g, '')
charMap['ь'] == ''
charMap['ь'] || 'ь' == 'ь'

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in slugify.js at the linked line and reproduce the two console examples from the issue. Check the remove-option handling against the character-map lookup; done when using remove does not reintroduce an unmapped symbol such as the Cyrillic soft sign.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.