GithubHelp home page GithubHelp logo

petertrr / kotlin-multiplatform-diff Goto Github PK

View Code? Open in Web Editor NEW
69.0 2.0 4.0 485 KB

Multiplaform kotlin library for calculating text differences. Based on java-diff-utils, supports JVM, JS and native targets.

License: Apache License 2.0

Kotlin 100.00%
kotlin kmp multiplatform multiplatform-kotlin-library diff kotlin-library kotlin-native kotlin-jvm kotlin-js

kotlin-multiplatform-diff's Introduction

kotlin-multiplatform-diff

Build and test License codecov

Releases Maven Central Awesome Kotlin Badge

This is a port of java-diff-utils to kotlin with multiplatform support. All credit for the implementation goes to original authors.

Features

All features from version 4.10 of the original library are present, except for:

  • Unified diff, which heavily uses file read/write and therefore needs a more complicated rewrite for kotlin-multiplatform
  • diff-utils-jgit, which uses JVM-only jgit library

Please refer to the original guides for more information.

Supported platforms

Currently, artifacts for the following platforms are supported:

  • JVM
  • JS (both browser and Node.js)
  • LinuxX64
  • MingwX64
  • MacosX64

kotlin-multiplatform-diff's People

Contributors

lppedd avatar petertrr avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

kotlin-multiplatform-diff's Issues

Incorrect behavior of ChangeDelta

Let's consider the following code:

val expectedData = listOf("Some line ")
val actualData = listOf("Some line")
val st = diff(expectedData, actualData).formatToString()
println("Status: $st")

And the result will be:
Status: [ChangeDelta, position 0, lines: [Some line[ ]]], so we can see, that the white space is absent - everything is ok.


However, if we add white space to the actualData, instead of expected:

val expectedData = listOf("Some line")
val actualData = listOf("Some line ")
val st = diff(expectedData, actualData).formatToString()
println("Status: $st")

The result will be
Status: [ChangeDelta, position 0, lines: [Some line]]
By this output, it's unclear what's going on, and it seems, that all data Some line is absent, instead of white space.

Also, maybe it will be convenient, if ChangeDelta will additionally print in which input there is the difference

E.g.
[ChangeDelta, position 0, lines: [["Absent data in actual input: ", Some line[ ]].....]
[ChangeDelta, position 0, lines: [["Extra data in actual input", Some line<>]....]

Or in some other manner

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.