@quenty/binarysearch 2.2.0 → 2.2.1

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 CHANGED
@@ -3,6 +3,17 @@
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
+ ## [2.2.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/binarysearch@2.2.0...@quenty/binarysearch@2.2.1) (2025-04-05)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Add types to packages ([2374fb2](https://github.com/Quenty/NevermoreEngine/commit/2374fb2b043cfbe0e9b507b3316eec46a4e353a0))
12
+
13
+
14
+
15
+
16
+
6
17
  # [2.2.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/binarysearch@2.1.1...@quenty/binarysearch@2.2.0) (2024-05-09)
7
18
 
8
19
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/binarysearch",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Binary search for Roblox",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -28,5 +28,5 @@
28
28
  "publishConfig": {
29
29
  "access": "public"
30
30
  },
31
- "gitHead": "3fd5cdca3128bf34c8d9dfae1e92d62533b6e6f5"
31
+ "gitHead": "78c3ac0ab08dd18085b6e6e6e4f745e76ed99f68"
32
32
  }
@@ -1,3 +1,4 @@
1
+ --!strict
1
2
  --[=[
2
3
  Binary search implementation for Roblox in pure Lua
3
4
  @class BinarySearchUtils
@@ -15,10 +16,10 @@ local BinarySearchUtils = {}
15
16
 
16
17
  @param list {T}
17
18
  @param t number
18
- @return number
19
- @return number
19
+ @return number?
20
+ @return number?
20
21
  ]=]
21
- function BinarySearchUtils.spanSearch(list, t)
22
+ function BinarySearchUtils.spanSearch(list: { number }, t: number): (number?, number?)
22
23
  local l = 1
23
24
  local h = #list
24
25
 
@@ -33,8 +34,8 @@ function BinarySearchUtils.spanSearch(list, t)
33
34
  end
34
35
 
35
36
  while 1 < h - l do
36
- local m = (l + h)/2
37
- m = m - m%1
37
+ local m = (l + h) / 2
38
+ m = m - m % 1
38
39
 
39
40
  if t < list[m] then
40
41
  h = m
@@ -51,10 +52,10 @@ end
51
52
  @param list { TNode }
52
53
  @param index string
53
54
  @param t number
54
- @return number
55
- @return number
55
+ @return number?
56
+ @return number?
56
57
  ]=]
57
- function BinarySearchUtils.spanSearchNodes(list, index, t)
58
+ function BinarySearchUtils.spanSearchNodes(list: { any }, index: string, t: number): (number?, number?)
58
59
  local l = 1
59
60
  local h = #list
60
61
 
@@ -69,8 +70,8 @@ function BinarySearchUtils.spanSearchNodes(list, index, t)
69
70
  end
70
71
 
71
72
  while 1 < h - l do
72
- local m = (l + h)/2
73
- m = m - m%1
73
+ local m = (l + h) / 2
74
+ m = m - m % 1
74
75
 
75
76
  if t < list[m][index] then
76
77
  h = m
@@ -89,7 +90,7 @@ end
89
90
  @return number
90
91
  @return number
91
92
  ]=]
92
- function BinarySearchUtils.spanSearchAnything(n, indexFunc, t)
93
+ function BinarySearchUtils.spanSearchAnything(n: number, indexFunc: (number) -> (number), t: number): (number?, number?)
93
94
  local l = 1
94
95
  local h = n
95
96