@quenty/fzy 5.9.3 → 5.9.4-canary.11a5dcf.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/package.json +3 -3
- package/src/Shared/Fzy.lua +1 -1
- package/src/Shared/Fzy.spec.lua +21 -21
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [5.9.4-canary.11a5dcf.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/fzy@5.9.3...@quenty/fzy@5.9.4-canary.11a5dcf.0) (2025-05-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/fzy
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [5.9.3](https://github.com/Quenty/NevermoreEngine/compare/@quenty/fzy@5.9.2...@quenty/fzy@5.9.3) (2025-04-10)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @quenty/fzy
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/fzy",
|
|
3
|
-
"version": "5.9.
|
|
3
|
+
"version": "5.9.4-canary.11a5dcf.0",
|
|
4
4
|
"description": "Lua implementation of fzy string search algorithm",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"Quenty"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@quenty/loader": "
|
|
27
|
+
"@quenty/loader": "10.8.4-canary.11a5dcf.0"
|
|
28
28
|
},
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "11a5dcf7d4c7a0bfbf3337e97d30e8346ea09d3f"
|
|
33
33
|
}
|
package/src/Shared/Fzy.lua
CHANGED
package/src/Shared/Fzy.spec.lua
CHANGED
|
@@ -34,7 +34,8 @@ THE SOFTWARE.
|
|
|
34
34
|
|
|
35
35
|
local EPSILON = 0.000001
|
|
36
36
|
|
|
37
|
-
local require =
|
|
37
|
+
local require =
|
|
38
|
+
require(game:GetService("ServerScriptService"):FindFirstChild("LoaderUtils", true).Parent).bootstrapStory(script)
|
|
38
39
|
|
|
39
40
|
local Fzy = require("Fzy")
|
|
40
41
|
local Jest = require("Jest")
|
|
@@ -63,10 +64,10 @@ local function compareTables(a, b)
|
|
|
63
64
|
end
|
|
64
65
|
|
|
65
66
|
local config = Fzy.createConfig({
|
|
66
|
-
caseSensitive = false
|
|
67
|
+
caseSensitive = false,
|
|
67
68
|
})
|
|
68
69
|
local caseSensitiveConfig = Fzy.createConfig({
|
|
69
|
-
caseSensitive = true
|
|
70
|
+
caseSensitive = true,
|
|
70
71
|
})
|
|
71
72
|
local MATCH_MAX_LENGTH = Fzy.getMaxLength(config)
|
|
72
73
|
|
|
@@ -187,25 +188,25 @@ end)
|
|
|
187
188
|
|
|
188
189
|
describe("positioning", function()
|
|
189
190
|
it("favors consecutive positions", function()
|
|
190
|
-
expect(compareTables({1, 5, 6}, Fzy.positions(config, "amo", "app/models/foo"))).toBe(true)
|
|
191
|
+
expect(compareTables({ 1, 5, 6 }, Fzy.positions(config, "amo", "app/models/foo"))).toBe(true)
|
|
191
192
|
end)
|
|
192
193
|
it("favors word beginnings", function()
|
|
193
|
-
expect(compareTables({1, 5, 12, 13}, Fzy.positions(config, "amor", "app/models/order"))).toBe(true)
|
|
194
|
-
expect(compareTables({3, 4}, Fzy.positions(config, "aa", "baAa"))).toBe(true)
|
|
195
|
-
expect(compareTables({4}, Fzy.positions(config, "a", "ba.a"))).toBe(true)
|
|
194
|
+
expect(compareTables({ 1, 5, 12, 13 }, Fzy.positions(config, "amor", "app/models/order"))).toBe(true)
|
|
195
|
+
expect(compareTables({ 3, 4 }, Fzy.positions(config, "aa", "baAa"))).toBe(true)
|
|
196
|
+
expect(compareTables({ 4 }, Fzy.positions(config, "a", "ba.a"))).toBe(true)
|
|
196
197
|
end)
|
|
197
198
|
it("works when there are no bonuses", function()
|
|
198
|
-
expect(compareTables({2, 4}, Fzy.positions(config, "as", "tags"))).toBe(true)
|
|
199
|
-
expect(compareTables({3, 8}, Fzy.positions(config, "as", "examples.txt"))).toBe(true)
|
|
199
|
+
expect(compareTables({ 2, 4 }, Fzy.positions(config, "as", "tags"))).toBe(true)
|
|
200
|
+
expect(compareTables({ 3, 8 }, Fzy.positions(config, "as", "examples.txt"))).toBe(true)
|
|
200
201
|
end)
|
|
201
202
|
it("favors smaller groupings of positions", function()
|
|
202
|
-
expect(compareTables({3, 5, 7}, Fzy.positions(config, "abc", "a/a/b/c/c"))).toBe(true)
|
|
203
|
-
expect(compareTables({3, 5, 7}, Fzy.positions(config, "abc", "a\\a\\b\\c\\c"))).toBe(true)
|
|
204
|
-
expect(compareTables({4, 6, 8}, Fzy.positions(config, "abc", "*a*a*b*c*c"))).toBe(true)
|
|
205
|
-
expect(compareTables({3, 5}, Fzy.positions(config, "ab", "caacbbc"))).toBe(true)
|
|
203
|
+
expect(compareTables({ 3, 5, 7 }, Fzy.positions(config, "abc", "a/a/b/c/c"))).toBe(true)
|
|
204
|
+
expect(compareTables({ 3, 5, 7 }, Fzy.positions(config, "abc", "a\\a\\b\\c\\c"))).toBe(true)
|
|
205
|
+
expect(compareTables({ 4, 6, 8 }, Fzy.positions(config, "abc", "*a*a*b*c*c"))).toBe(true)
|
|
206
|
+
expect(compareTables({ 3, 5 }, Fzy.positions(config, "ab", "caacbbc"))).toBe(true)
|
|
206
207
|
end)
|
|
207
208
|
it("handles exact matches", function()
|
|
208
|
-
expect(compareTables({1, 2, 3}, Fzy.positions(config, "foo", "foo"))).toBe(true)
|
|
209
|
+
expect(compareTables({ 1, 2, 3 }, Fzy.positions(config, "foo", "foo"))).toBe(true)
|
|
209
210
|
end)
|
|
210
211
|
it("ignores empty requests", function()
|
|
211
212
|
expect(compareTables({}, Fzy.positions(config, "", ""))).toBe(true)
|
|
@@ -218,7 +219,7 @@ describe("positioning", function()
|
|
|
218
219
|
expect(Fzy.score(config, longstring, longstring)).toBe(MIN_SCORE)
|
|
219
220
|
end)
|
|
220
221
|
it("is case-sensitive when requested", function()
|
|
221
|
-
expect(compareTables({2, 5}, Fzy.positions(caseSensitiveConfig, "AB", "aAabBb", true))).toBe(true)
|
|
222
|
+
expect(compareTables({ 2, 5 }, Fzy.positions(caseSensitiveConfig, "AB", "aAabBb", true))).toBe(true)
|
|
222
223
|
end)
|
|
223
224
|
it("returns the same score as `score()`", function()
|
|
224
225
|
local _, s = Fzy.positions(config, "ab", "aaabbb")
|
|
@@ -232,7 +233,6 @@ end)
|
|
|
232
233
|
|
|
233
234
|
describe("filtering", function()
|
|
234
235
|
it("repeats application of hasMatch and positions", function()
|
|
235
|
-
|
|
236
236
|
-- compare the result of `filter` with repeated calls to `positions`
|
|
237
237
|
local function check_filter(needle, haystacks, case)
|
|
238
238
|
local result = Fzy.filter(config, needle, haystacks, case)
|
|
@@ -250,10 +250,10 @@ describe("filtering", function()
|
|
|
250
250
|
expect(#result).toBe(r)
|
|
251
251
|
end
|
|
252
252
|
|
|
253
|
-
check_filter("a", {"a", "A", "aa", "b", ""})
|
|
254
|
-
check_filter("a", {"a", "A", "aa", "b", ""}, true)
|
|
255
|
-
check_filter("", {"a", "A", "aa", "b", ""})
|
|
256
|
-
check_filter("a", {"b"})
|
|
253
|
+
check_filter("a", { "a", "A", "aa", "b", "" })
|
|
254
|
+
check_filter("a", { "a", "A", "aa", "b", "" }, true)
|
|
255
|
+
check_filter("", { "a", "A", "aa", "b", "" })
|
|
256
|
+
check_filter("a", { "b" })
|
|
257
257
|
check_filter("a", {})
|
|
258
258
|
end)
|
|
259
|
-
end)
|
|
259
|
+
end)
|