@quenty/string 2.3.0 → 3.0.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 +11 -0
- package/LICENSE.md +1 -1
- package/package.json +2 -2
- package/src/Shared/String.lua +6 -5
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
|
+
# [3.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/string@2.3.0...@quenty/string@3.0.0) (2022-08-14)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Add seperator parameter to String library which allows comma seperator to be specified ([4bd70ae](https://github.com/Quenty/NevermoreEngine/commit/4bd70aefd30fb06447f0175a8ff94745bb1444c4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [2.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/string@2.2.1...@quenty/string@2.3.0) (2022-03-27)
|
|
7
18
|
|
|
8
19
|
|
package/LICENSE.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/string",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "This module provides utility functions for strings",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"publishConfig": {
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "dbb62609f980983cc32da90acfef13e30ed41113"
|
|
32
32
|
}
|
package/src/Shared/String.lua
CHANGED
|
@@ -24,7 +24,7 @@ function String.trim(str: string, pattern: string?): string
|
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
--[=[
|
|
27
|
-
Converts the string to UpperCamelCase
|
|
27
|
+
Converts the string to `UpperCamelCase` from `camelCase` or `snakeCase` or `YELL_CASE`
|
|
28
28
|
@param str string
|
|
29
29
|
@return string
|
|
30
30
|
]=]
|
|
@@ -37,7 +37,6 @@ function String.toCamelCase(str: string): string
|
|
|
37
37
|
return str
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
|
|
41
40
|
--[=[
|
|
42
41
|
Uppercases the first letter of the string
|
|
43
42
|
@param str string
|
|
@@ -48,7 +47,7 @@ function String.uppercaseFirstLetter(str: string): string
|
|
|
48
47
|
end
|
|
49
48
|
|
|
50
49
|
--[=[
|
|
51
|
-
Converts to the string to lowerCamelCase
|
|
50
|
+
Converts to the string to `lowerCamelCase` from `camelCase` or `snakeCase` or `YELL_CASE`
|
|
52
51
|
@param str string
|
|
53
52
|
@return string
|
|
54
53
|
]=]
|
|
@@ -182,17 +181,19 @@ end
|
|
|
182
181
|
--[=[
|
|
183
182
|
Adds commas to a number. Not culture aware.
|
|
184
183
|
@param number string | number
|
|
184
|
+
@param seperator string?
|
|
185
185
|
@return string
|
|
186
186
|
]=]
|
|
187
|
-
function String.addCommas(number: string | number): string
|
|
187
|
+
function String.addCommas(number: string | number, seperator: string): string
|
|
188
188
|
if type(number) == "number" then
|
|
189
189
|
number = tostring(number)
|
|
190
190
|
end
|
|
191
|
+
seperator = seperator or ","
|
|
191
192
|
|
|
192
193
|
local index = -1
|
|
193
194
|
|
|
194
195
|
while index ~= 0 do
|
|
195
|
-
number, index = string.gsub(number, "^(-?%d+)(%d%d%d)",
|
|
196
|
+
number, index = string.gsub(number, "^(-?%d+)(%d%d%d)", "%1" .. seperator .. "%2")
|
|
196
197
|
end
|
|
197
198
|
|
|
198
199
|
return number
|