@quenty/textfilterutils 10.10.1 → 10.10.2
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 +11 -0
- package/package.json +5 -4
- package/src/Shared/TextFilterUtils.lua +12 -10
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
|
+
## [10.10.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/textfilterutils@10.10.1...@quenty/textfilterutils@10.10.2) (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
|
## [10.10.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/textfilterutils@10.10.0...@quenty/textfilterutils@10.10.1) (2025-03-21)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @quenty/textfilterutils
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/textfilterutils",
|
|
3
|
-
"version": "10.10.
|
|
3
|
+
"version": "10.10.2",
|
|
4
4
|
"description": "Utility functions for filtering text",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,11 +25,12 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/loader": "^10.8.
|
|
29
|
-
"@quenty/promise": "^10.10.
|
|
28
|
+
"@quenty/loader": "^10.8.1",
|
|
29
|
+
"@quenty/promise": "^10.10.2",
|
|
30
|
+
"@quenty/typeutils": "^1.0.1"
|
|
30
31
|
},
|
|
31
32
|
"publishConfig": {
|
|
32
33
|
"access": "public"
|
|
33
34
|
},
|
|
34
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "78c3ac0ab08dd18085b6e6e6e4f745e76ed99f68"
|
|
35
36
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
--!strict
|
|
1
2
|
--[=[
|
|
2
3
|
Utility functions for filtering text wrapping [TextService] and legacy [Chat] API surfaces.
|
|
3
4
|
|
|
@@ -10,6 +11,7 @@ local TextService = game:GetService("TextService")
|
|
|
10
11
|
local Chat = game:GetService("Chat")
|
|
11
12
|
|
|
12
13
|
local Promise = require("Promise")
|
|
14
|
+
local TypeUtils = require("TypeUtils")
|
|
13
15
|
|
|
14
16
|
local TextFilterUtils = {}
|
|
15
17
|
|
|
@@ -34,7 +36,7 @@ function TextFilterUtils.promiseNonChatStringForBroadcast(
|
|
|
34
36
|
text: string,
|
|
35
37
|
fromUserId: number,
|
|
36
38
|
textFilterContext: Enum.TextFilterContext
|
|
37
|
-
)
|
|
39
|
+
): Promise.Promise<string>
|
|
38
40
|
assert(type(text) == "string", "Bad text")
|
|
39
41
|
assert(type(fromUserId) == "number", "Bad fromUserId")
|
|
40
42
|
assert(typeof(textFilterContext) == "EnumItem", "Bad textFilterContext")
|
|
@@ -112,13 +114,13 @@ end
|
|
|
112
114
|
@param text string
|
|
113
115
|
@param fromUserId number
|
|
114
116
|
@param textFilterContext TextFilterContext
|
|
115
|
-
@return
|
|
117
|
+
@return (string?, string?)
|
|
116
118
|
]=]
|
|
117
119
|
function TextFilterUtils.getNonChatStringForBroadcastAsync(
|
|
118
120
|
text: string,
|
|
119
121
|
fromUserId: number,
|
|
120
122
|
textFilterContext: Enum.TextFilterContext
|
|
121
|
-
)
|
|
123
|
+
): (string?, string?)
|
|
122
124
|
assert(type(text) == "string", "Bad text")
|
|
123
125
|
assert(type(fromUserId) == "number", "Bad fromUserId")
|
|
124
126
|
assert(typeof(textFilterContext) == "EnumItem", "Bad textFilterContext")
|
|
@@ -134,7 +136,7 @@ function TextFilterUtils.getNonChatStringForBroadcastAsync(
|
|
|
134
136
|
end)
|
|
135
137
|
|
|
136
138
|
if not ok then
|
|
137
|
-
return
|
|
139
|
+
return nil, err
|
|
138
140
|
end
|
|
139
141
|
|
|
140
142
|
return resultText
|
|
@@ -147,14 +149,14 @@ end
|
|
|
147
149
|
@param fromUserId number
|
|
148
150
|
@param toUserId number
|
|
149
151
|
@param textFilterContext TextFilterContext
|
|
150
|
-
@return
|
|
152
|
+
@return (string?, string?)
|
|
151
153
|
]=]
|
|
152
154
|
function TextFilterUtils.getNonChatStringForUserAsync(
|
|
153
155
|
text: string,
|
|
154
156
|
fromUserId: number,
|
|
155
157
|
toUserId: number,
|
|
156
158
|
textFilterContext: Enum.TextFilterContext
|
|
157
|
-
)
|
|
159
|
+
): (string?, string?)
|
|
158
160
|
assert(type(text) == "string", "Bad text")
|
|
159
161
|
assert(type(fromUserId) == "number", "Bad fromUserId")
|
|
160
162
|
assert(type(toUserId) == "number", "Bad toUserId")
|
|
@@ -171,17 +173,17 @@ function TextFilterUtils.getNonChatStringForUserAsync(
|
|
|
171
173
|
end)
|
|
172
174
|
|
|
173
175
|
if not ok then
|
|
174
|
-
return
|
|
176
|
+
return nil, err
|
|
175
177
|
end
|
|
176
178
|
|
|
177
179
|
return textResult
|
|
178
180
|
end
|
|
179
181
|
|
|
180
|
-
function TextFilterUtils._promiseTextResult(getResult, ...)
|
|
181
|
-
local args =
|
|
182
|
+
function TextFilterUtils._promiseTextResult<T...>(getResult: (T...) -> (string?, string?), ...: T...): Promise.Promise<string>
|
|
183
|
+
local args = table.pack(...)
|
|
182
184
|
|
|
183
185
|
local promise = Promise.spawn(function(resolve, reject)
|
|
184
|
-
local text, err = getResult(unpack(args))
|
|
186
|
+
local text, err = getResult(TypeUtils.anyValue(table.unpack(args, 1, args.n)))
|
|
185
187
|
if not text then
|
|
186
188
|
return reject(err or "Pcall failed")
|
|
187
189
|
end
|