Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/avh4/elm-diff
https://github.com/avh4/elm-diff
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/avh4/elm-diff
- Owner: avh4
- Created: 2015-01-21T07:43:19.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-11-19T02:08:26.000Z (about 8 years ago)
- Last Synced: 2024-04-13T16:20:15.540Z (8 months ago)
- Language: Elm
- Size: 35.2 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Compares strings to produce change lists. `diffChars` and `diffLines` are provided.
The currently-implemented algorithm is the [Hunt-McIlroy algorithm](http://en.wikipedia.org/wiki/Hunt%E2%80%93McIlroy_algorithm).
Pull requests optimizing the existing algorithm are welcome.
Pull requests implementing alternative diff algorithms (notably, the [Patience algorithm](http://alfedenzo.livejournal.com/170301.html)) are also welcome.
```elm
import Diff (..)diffChars "abc" "aBcd"
-- [ NoChange "a", Changed "b" "B", NoChange "c", Added "d" ]original = """Brian
Sohie
Oscar
Stella
Takis
"""changed = """BRIAN
Stella
Frosty
Takis
"""diffLines original changed
-- [ Changed "Brian\nSohie\nOscar\n" "BRIAN\n"
-- , NoChange "Stella\n"
-- , Added "Frosty\n"
-- , NoChange "Takis\n"
-- ]
```**This package should still be considered unstable:** while the returned list of changes will always be correct, the specific the list of changes and the way the changes are grouped/combined, as well as the performance characteristics of the diff algorithm may change in future releases of this package.