A

A stab at building my own string diffing library

Hacker News

A stab at building my own string diffing library

Took a stab at building my own string diffing JS package. I built an interactive demo for TypeIt’s website (https://typeitjs.com/build-your-own) a while back. The approach I took to handle user input necessitated a way to calculate the difference between the versions of a user’s text input. I searched around for a package to help me out and found a couple of good ones (like fast-diff), but I either didn’t really like their API or didn’t want to take on a huge new dependency. Instead, I thought I’d give it a shot myself (famous last words). I dove into it having no real formal knowledge of the algorithmic approaches to string diffing, and so things got frustrating real fast. But then I figured out a way to build it out using JavaScript symbols to link characters that helped ease the complexity a ton. It all resulted in “striff,” which comes in at just over 600 bytes gzipped, and that I’ve been using in production for a couple of months now. It’s a little weird looking back now, because I don’t think I’d recommend someone taking the same path in building your own, but at the same time, there’s an immense satisfaction knowing I was able to figure out a pretty reliable approach. Check it out: https://github.com/alexmacarthur/striff

Share card

Actual performance

29points
8comments
Made the leaderboard

Launch Intel predictions

Analyze your own launch →
Indie HackersFits the IH revenue-focused audience · Missing: supports, reddit linkedin, podcasting
90%90% predicted probability of success on Indie Hackers, based on ML models trained on real launch data.
best fitHighest predicted score across all platforms for this description.
Product HuntOn track for Day 1 leaderboard · Strong signals: mac, user, new · Missing: agents, macos, agent
79%79% predicted probability of success on Product Hunt, based on ML models trained on real launch data.
Hacker NewsStrong engagement from HN community · Strong signals: io · Missing: https docs, excited, just released
75%75% predicted probability of success on Hacker News, based on ML models trained on real launch data.
nativeThis product was originally launched on this platform.
AppSumoMay struggle as an AppSumo deal · Missing: plus, platform, intuitive
47%47% predicted probability of success on AppSumo, based on ML models trained on real launch data.
TrustMRRLess likely to generate early MRR · Strong signals: month, way · Missing: mobile apps, ios, personal
40%40% predicted probability of success on TrustMRR, based on ML models trained on real launch data.
Acquire.comPre-revenue stage for this audience · Strong signals: active · Missing: arr, mrr, revenue
12%12% predicted probability of success on Acquire.com, based on ML models trained on real launch data.
BetaListMay not resonate with beta-testers · Missing: web3, chat, crypto
0%0% predicted probability of success on BetaList, based on ML models trained on real launch data.

Correct prediction on native model

Similar products

Li
Library for building distributed WebSocket applications74%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Library for building distributed WebSocket applications

Hacker News7
Vi
Victory – ReactJS library for building interactive data visualizations64%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Victory – ReactJS library for building interactive data visualizations

Hacker News220
ApexCharts
ApexCharts13%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

An open-source charting library for building visualizations

Indie Hackerscommitment-side-project
ma
mario.py, a convenience library for i/o35%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

mario.py, a convenience library for i/o

Hacker News2
Li
Livewire: Livescript microrouting library51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Livewire: Livescript microrouting library

Hacker News2
A
A Dropbox library for Go54%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

A Dropbox library for Go

Hacker News3
Dj
Django passbook library released47%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Django passbook library released

Hacker News1
ID
ID3 library in Go51%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

ID3 library in Go

Hacker News3
vs
vsqlite++ - The C++ SQLite wrapper library59%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

vsqlite++ - The C++ SQLite wrapper library

Hacker News2
Cm
Cmods – a header-only C modules library62%Launch Intel prediction score: how likely this product is to succeed on its source platform, based on its name, tagline, and description.

Cmods – a header-only C modules library

Hacker News9