Skip to content

Commit 91bd966

Browse files
committed
initial commit
0 parents  commit 91bd966

File tree

15 files changed

+834
-0
lines changed

15 files changed

+834
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
target
2+
.idea
3+
.bsp

.scalafmt.conf

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version=2.7.3
2+
style = defaultWithAlign
3+
align.openParenCallSite = true
4+
align.openParenDefnSite = true
5+
align.arrowEnumeratorGenerator = true
6+
maxColumn = 180
7+
continuationIndent.defnSite = 2
8+
assumeStandardLibraryStripMargin = true
9+
danglingParentheses.defnSite = true
10+
danglingParentheses.callSite = true
11+
rewrite.rules = [AvoidInfix, ExpandImportSelectors, RedundantParens, SortModifiers]
12+
docstrings = JavaDoc
13+
newlines.afterCurlyLambda = preserve
14+
docstrings.style = Asterisk
15+
docstrings.oneline = unfold
16+
trailingCommas = "never"
17+
optIn.breaksInsideChains = true
18+
includeCurlyBraceInSelectChains = true

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
3+
### 0.2.0
4+
5+
Adding apply converters for converting `FunctionN[..., Out]` into `Function1[TupleN[...], Out]`
6+
7+
### 0.1.0
8+
9+
* initial release

LICENSE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# The MIT License (MIT)
2+
3+
Copyright 2020 Iurii Malchenko
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10+

README.md

Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
![Maven Central](https://img.shields.io/maven-central/v/app.tulz/stringdiff_sjs1_2.13.svg)
2+
3+
### app.tulz.diff
4+
5+
A library for diff-ing strings.
6+
7+
```scala
8+
"app.tulz" %%% "stringdiff" % "0.1.0"
9+
```
10+
11+
12+
```scala
13+
import app.tulz.diff.StringDiff
14+
15+
StringDiff("prefix common1 common2 inside1 common3 common4", "common1 common2 inside2 common3 suffix")
16+
// or
17+
StringDiff.default("prefix common1 common2 inside1 common3 common4", "common1 common2 inside2 common3 suffix")
18+
```
19+
20+
![screenshot 1](doc/images/screenshot1.png)
21+
22+
```scala
23+
import app.tulz.diff.StringDiff
24+
25+
StringDiff.xml("prefix common1 common2 inside1 common3 common4", "common1 common2 inside2 common3 suffix")
26+
```
27+
28+
```xml
29+
<diff><no-match><expected><empty/></expected><actual>prefix </actual></no-match><match>common1 common2 </match><no-match><expected>inside2</expected><actual>inside1</actual></no-match><match> common3 </match><no-match><expected>suffix</expected><actual>common4</actual></no-match></diff>
30+
```
31+
32+
33+
```scala
34+
35+
36+
import scala.Console._
37+
38+
val diff = new StringDiff(
39+
beforeAll = "",
40+
beforeNoMatch = "[",
41+
beforeExpected = s"expected: ${YELLOW}",
42+
afterExpected = RESET,
43+
between = ", ",
44+
beforeActual = s"actual: ${RED}",
45+
afterActual = RESET,
46+
empty = s"${MAGENTA}empty${RESET}",
47+
afterNoMatch = "]",
48+
beforeMatch = GREEN,
49+
afterMatch = RESET,
50+
afterAll = ""
51+
)
52+
53+
diff("prefix common1 common2 inside1 common3 common4", "common1 common2 inside2 common3 suffix")
54+
55+
// custom
56+
```
57+
![screenshot 2](doc/images/screenshot2.png)
58+
59+
### More examples
60+
61+
```
62+
token1 token2 token3
63+
token1 token2 token3
64+
```
65+
66+
<pre style="background-color: #222">
67+
<span>token1 token2 token3</span>
68+
</pre>
69+
70+
---
71+
72+
```
73+
prefix1 match1 match2 match3
74+
prefix2 match1 match2 match3
75+
```
76+
77+
<pre style="background-color: #222">
78+
[<span style="color:#A50">prefix2</span>|<span style="color:#A00">prefix1</span>] match1 match2 match3
79+
</pre>
80+
81+
---
82+
83+
```
84+
match1 match2 match3 suffix1
85+
match1 match2 match3 suffix2
86+
```
87+
88+
<pre style="background-color: #222">
89+
match1 match2 match3 [<span style="color:#A50">suffix2</span>|<span style="color:#A00">suffix1</span>]
90+
</pre>
91+
92+
---
93+
94+
```
95+
match1 match2 inside1 match3
96+
match1 match2 inside2 match3
97+
```
98+
99+
<pre style="background-color: #222">
100+
match1 match2 [<span style="color:#A50">inside2</span>|<span style="color:#A00">inside1</span>] match3
101+
</pre>
102+
103+
---
104+
105+
```
106+
prefix1 match1 match2 inside1 match3 suffix1
107+
prefix2 match1 match2 inside2 match3 suffix2
108+
```
109+
110+
<pre style="background-color: #222">
111+
[<span style="color:#A50">prefix2</span>|<span style="color:#A00">prefix1</span>] match1 match2 [<span style="color:#A50">inside2</span>|<span style="color:#A00">inside1</span>] match3 [<span style="color:#A50">suffix2</span>|<span style="color:#A00">suffix1</span>]
112+
</pre>
113+
114+
---
115+
116+
```
117+
prefix1 match1 match2 match3
118+
match1 match2 match3
119+
```
120+
121+
<pre style="background-color: #222">
122+
[<span style="color:#A50">∅</span>|<span style="color:#A00">prefix1 </span>]match1 match2 match3
123+
</pre>
124+
125+
---
126+
127+
```
128+
match1 match2 match3
129+
prefix1 match1 match2 match3
130+
```
131+
132+
<pre style="background-color: #222">
133+
[<span style="color:#A50">prefix1 </span>|<span style="color:#A00">∅</span>]match1 match2 match3
134+
</pre>
135+
136+
---
137+
138+
```
139+
match1 match2 match3 suffix1
140+
match1 match2 match3
141+
```
142+
143+
<pre style="background-color: #222">
144+
match1 match2 match3[<span style="color:#A50">∅</span>|<span style="color:#A00"> suffix1</span>]
145+
</pre>
146+
147+
---
148+
149+
```
150+
match1 match2 match3
151+
match1 match2 match3 suffix1
152+
```
153+
154+
<pre style="background-color: #222">
155+
match1 match2 match3[<span style="color:#A50"> suffix1</span>|<span style="color:#A00">∅</span>]
156+
</pre>
157+
158+
---
159+
160+
```
161+
prefix1 match1 match2 match3 suffix1
162+
match1 match2 match3
163+
```
164+
165+
<pre style="background-color: #222">
166+
[<span style="color:#A50">∅</span>|<span style="color:#A00">prefix1 </span>]match1 match2 match3[<span style="color:#A50">∅</span>|<span style="color:#A00"> suffix1</span>]
167+
</pre>
168+
169+
---
170+
171+
```
172+
prefix1 match1 match2 match3 suffix1
173+
match1 match2 match3
174+
```
175+
176+
<pre style="background-color: #222">
177+
[<span style="color:#A50">∅</span>|<span style="color:#A00">prefix1 </span>]match1 match2 match3[<span style="color:#A50">∅</span>|<span style="color:#A00"> suffix1</span>]
178+
</pre>
179+
180+
---
181+
182+
```
183+
match1 match2 match3
184+
prefix1 match1 match2 match3 suffix1
185+
```
186+
187+
<pre style="background-color: #222">
188+
[<span style="color:#A50">prefix1 </span>|<span style="color:#A00">∅</span>]match1 match2 match3[<span style="color:#A50"> suffix1</span>|<span style="color:#A00">∅</span>]
189+
</pre>
190+
191+
---
192+
193+
```
194+
prefix1 match1 match2 inside1 match3 match4 suffix1
195+
match1 match2 match3 match4
196+
```
197+
198+
<pre style="background-color: #222">
199+
[<span style="color:#A50">∅</span>|<span style="color:#A00">prefix1 </span>]match1 match2 [<span style="color:#A50">∅</span>|<span style="color:#A00">inside1 </span>]match3 match4[<span style="color:#A50">∅</span>|<span style="color:#A00"> suffix1</span>]
200+
</pre>
201+
202+
---
203+
204+
```
205+
match1 match2 match3 match4
206+
prefix1 match1 match2 inside1 match3 match4 suffix1
207+
```
208+
209+
<pre style="background-color: #222">
210+
[<span style="color:#A50">prefix1 </span>|<span style="color:#A00">∅</span>]match1 match2 [<span style="color:#A50">inside1 </span>|<span style="color:#A00">∅</span>]match3 match4[<span style="color:#A50"> suffix1</span>|<span style="color:#A00">∅</span>]
211+
</pre>
212+
213+
---
214+
215+
```
216+
match1 match2 inside1 match3 match4
217+
prefix1 match1 match2 match3 match4 suffix1
218+
```
219+
220+
<pre style="background-color: #222">
221+
[<span style="color:#A50">prefix1 </span>|<span style="color:#A00">∅</span>]match1 match2 [<span style="color:#A50">∅</span>|<span style="color:#A00">inside1 </span>]match3 match4[<span style="color:#A50"> suffix1</span>|<span style="color:#A00">∅</span>]
222+
</pre>
223+
224+
---
225+
226+
```
227+
prefix1 match1 match2 match3 match4 suffix1
228+
match1 match2 inside1 match3 match4
229+
```
230+
231+
<pre style="background-color: #222">
232+
[<span style="color:#A50">∅</span>|<span style="color:#A00">prefix1 </span>]match1 match2 [<span style="color:#A50">inside1 </span>|<span style="color:#A00">∅</span>]match3 match4[<span style="color:#A50">∅</span>|<span style="color:#A00"> suffix1</span>]
233+
</pre>
234+
235+
---
236+
237+
238+
239+
## Author
240+
241+
Iurii Malchenko – [@yurique](https://twitter.com/yurique)
242+
243+
244+
## License
245+
246+
`stringdiff` is provided under the [MIT license](https://github.com/tulz-app/stringdiff/blob/main/LICENSE.md).

build.sbt

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
ThisBuild / organization := "app.tulz"
2+
ThisBuild / homepage := Some(url("https://github.com/tulz-app/stringdiff"))
3+
ThisBuild / licenses += ("MIT", url("https://github.com/tulz-app/stringdiff/blob/main/LICENSE.md"))
4+
ThisBuild / developers := List(
5+
Developer(
6+
id = "yurique",
7+
name = "Iurii Malchenko",
8+
email = "i@yurique.com",
9+
url = url("https://github.com/yurique")
10+
)
11+
)
12+
ThisBuild / releasePublishArtifactsAction := PgpKeys.publishSigned.value
13+
ThisBuild / publishTo := sonatypePublishToBundle.value
14+
ThisBuild / pomIncludeRepository := { _ => false }
15+
ThisBuild / sonatypeProfileName := "yurique"
16+
ThisBuild / publishArtifact in Test := false
17+
ThisBuild / publishMavenStyle := true
18+
ThisBuild / releaseCrossBuild := true
19+
20+
lazy val stringdiff =
21+
crossProject(JVMPlatform, JSPlatform)
22+
.crossType(CrossType.Pure)
23+
.in(file("stringdiff"))
24+
.settings(
25+
scalaVersion := "2.13.4",
26+
crossScalaVersions := Seq("2.12.12", "2.13.4"),
27+
scalacOptions := Seq(
28+
"-unchecked",
29+
"-deprecation",
30+
"-feature",
31+
"-Xlint:nullary-unit,inaccessible,infer-any,missing-interpolator,private-shadow,type-parameter-shadow,poly-implicit-overload,option-implicit,delayedinit-select,stars-align",
32+
"-Xcheckinit",
33+
"-Ywarn-value-discard",
34+
"-language:implicitConversions",
35+
"-encoding",
36+
"utf8"
37+
),
38+
libraryDependencies ++= Seq(
39+
"org.scalatest" %%% "scalatest" % "3.2.0" % Test
40+
),
41+
description := "String diff for scala.",
42+
scmInfo := Some(
43+
ScmInfo(
44+
url("https://github.com/tulz-app/stringdiff"),
45+
"scm:git@github.com/tulz-app/stringdiff.git"
46+
)
47+
)
48+
)
49+
50+
lazy val root = project
51+
.in(file("."))
52+
.settings()
53+
.aggregate(
54+
stringdiff.js,
55+
stringdiff.jvm
56+
)

doc/images/screenshot1.png

4.41 KB
Loading

doc/images/screenshot2.png

6.2 KB
Loading

project/build.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sbt.version=1.4.5

project/plugins.sbt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
logLevel := Level.Warn
2+
3+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.1.0")
4+
5+
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
6+
7+
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
8+
9+
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.2")
10+
11+
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5")
12+
13+
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.13")

0 commit comments

Comments
 (0)