@quenty/binarysearch 2.0.0 → 2.0.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,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
+ ## [2.0.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/binarysearch@2.0.0...@quenty/binarysearch@2.0.1) (2021-12-30)
7
+
8
+ **Note:** Version bump only for package @quenty/binarysearch
9
+
10
+
11
+
12
+
13
+
6
14
  # [2.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/binarysearch@1.2.0...@quenty/binarysearch@2.0.0) (2021-09-05)
7
15
 
8
16
 
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2014 Quenty
3
+ Copyright (c) 2014-2021 Quenty
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  ## Binary Search
2
2
  <div align="center">
3
- <a href="http://quenty.github.io/api/">
4
- <img src="https://img.shields.io/badge/docs-website-green.svg" alt="Documentation" />
3
+ <a href="http://quenty.github.io/NevermoreEngine/">
4
+ <img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
5
5
  </a>
6
6
  <a href="https://discord.gg/mhtGUS8">
7
- <img src="https://img.shields.io/badge/discord-nevermore-blue.svg" alt="Discord" />
7
+ <img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
8
8
  </a>
9
9
  <a href="https://github.com/Quenty/NevermoreEngine/actions">
10
10
  <img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/build.yml/badge.svg" alt="Build and release status" />
@@ -13,6 +13,8 @@
13
13
 
14
14
  Binary search implementation for Roblox in pure Lua
15
15
 
16
+ <div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/BinarySearchUtils">View docs →</a></div>
17
+
16
18
  ## Installation
17
19
  ```
18
20
  npm install @quenty/binarysearch --save
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/binarysearch",
3
- "version": "2.0.0",
3
+ "version": "2.0.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": "c06170ec47b0d4520c587ce2e6404d14b5dbb851"
31
+ "gitHead": "d146c77d0a8e452824de0ab0b4b03ba0370bcc1b"
32
32
  }
@@ -1,15 +1,23 @@
1
- --- Binary search implementation for Roblox in pure Lua
2
- -- @module BinarySearchUtils
1
+ --[=[
2
+ Binary search implementation for Roblox in pure Lua
3
+ @class BinarySearchUtils
4
+ ]=]
3
5
 
4
6
  local BinarySearchUtils = {}
5
7
 
6
- --[[
8
+ --[=[
9
+ ```
7
10
  if t lands within the domain of two spans of time
8
11
  t = 5
9
12
  [3 5][5 7]
10
13
  ^ picks this one
11
- ]]
14
+ ```
12
15
 
16
+ @param list {T}
17
+ @param t number
18
+ @return number
19
+ @return number
20
+ ]=]
13
21
  function BinarySearchUtils.spanSearch(list, t)
14
22
  local l = 1
15
23
  local h = #list
@@ -37,6 +45,15 @@ function BinarySearchUtils.spanSearch(list, t)
37
45
  return l, h
38
46
  end
39
47
 
48
+ --[=[
49
+ Same as searching a span, but uses a list of nodes
50
+
51
+ @param list { TNode }
52
+ @param index string
53
+ @param t number
54
+ @return number
55
+ @return number
56
+ ]=]
40
57
  function BinarySearchUtils.spanSearchNodes(list, index, t)
41
58
  local l = 1
42
59
  local h = #list
@@ -64,7 +81,14 @@ function BinarySearchUtils.spanSearchNodes(list, index, t)
64
81
  return l, h
65
82
  end
66
83
 
67
- -- What a meme
84
+ --[=[
85
+ Same as span search, but uses an indexFunc to retrieve the index
86
+ @param n number
87
+ @param indexFunc (number) -> number
88
+ @param t number
89
+ @return number
90
+ @return number
91
+ ]=]
68
92
  function BinarySearchUtils.spanSearchAnything(n, indexFunc, t)
69
93
  local l = 1
70
94
  local h = n