Skip to content

Feat/options api pattern refactor - #5

Merged
otnc merged 2 commits into
mainfrom
feat/options-api-pattern-refactor
Aug 23, 2026
Merged

Feat/options api pattern refactor#5
otnc merged 2 commits into
mainfrom
feat/options-api-pattern-refactor

Conversation

@otnc

@otnc otnc commented Aug 23, 2026

Copy link
Copy Markdown
Owner

No description provided.

otnc added 2 commits August 23, 2026 21:50
BREAKING CHANGE: findAll/contains take an options object instead of a
positional boolean. `findAll(text, true)` -> `findAll(text, { relaxed: true })`

- src/lib/patterns.ts: patterns are now declared as data (id/label/strict/
  source/samples) instead of being baked into one giant regex literal, and
  each pattern's samples auto-generate coverage in test/patterns.test.ts
- src/lib/regex.ts: builds regexStrict/regexRelaxed from the patterns list;
  strict patterns are always ordered before relaxed-only ones so greedy
  matches (e.g. "(?:爆笑){2,}") aren't shadowed by shorter relaxed-only
  alternatives
- fixed a latent bug where the "(笑)" branch after a stem required a
  trailing space, causing findAll to drop the stem from the match
  (e.g. findAll("うお(笑)") returned ["(笑)"] instead of ["うお(笑)"])
- added new strict patterns (うわ/さむ/いた/きも, 🙄/😏/🤡, 笑2回以上) and
  new relaxed-only patterns (😑/🙃/💀/🫠)
- README/CONTRIBUTING updated for the new API and the patterns.ts workflow
…ne endings

- src/lib/patterns.ts: drop the unused `label` field from PatternDefinition
  (id/strict/source/samples only); merge the "新規追加候補" stems into the
  regular strict stem section
- add ❗/❓/⁉️ as strict emoji patterns (alongside the existing ‼️)
- add phrase-based patterns sourced from
  https://note.com/kido_meigen/n/nc0fb2d47f6f6 and
  https://w.atwiki.jp/reisyou/pages/10.html:
  strict: かっこよ/えぐ/ど、どした/冗談ですやん/必死やん/そういうノリ
  relaxed-only (common enough alone that strict felt too aggressive):
  ちょ/ったく/おもろいな(あ)/すごいな(あ)
  skipped as too narrow or too likely to false-positive: よせやい/
  あたぼうよ/あらよっと/てやんでい (obscure, single-copypasta-specific),
  the "教養🤣" meme (one specific tweet, not a general construction)
- extend STEM_SUFFIX to optionally allow "!/?" before the w/笑 marker
  so phrases like "えぐー!笑" and "ど、どした?笑" match as one token
- test/patterns.test.ts: drop label from describe() titles
- .prettierrc.json / .gitattributes: adopt oto-lab/npm-eslint-prettier-ts's
  settings, in particular `* text=auto eol=lf` so Windows checkouts stop
  drifting from the LF committed in the repo
@otnc
otnc merged commit 0594bcc into main Aug 23, 2026
3 checks passed
@otnc
otnc deleted the feat/options-api-pattern-refactor branch August 23, 2026 14:20
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