@quenty/playerutils 8.13.1-canary.522.b5d379b.0 → 8.14.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 CHANGED
@@ -3,9 +3,12 @@
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
- ## [8.13.1-canary.522.b5d379b.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/playerutils@8.13.0...@quenty/playerutils@8.13.1-canary.522.b5d379b.0) (2024-11-24)
6
+ # [8.14.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/playerutils@8.13.0...@quenty/playerutils@8.14.0) (2024-12-03)
7
7
 
8
- **Note:** Version bump only for package @quenty/playerutils
8
+
9
+ ### Features
10
+
11
+ * Add PlayerUtils.formatDisplayName(name) and other useful methods ([61c9b97](https://github.com/Quenty/NevermoreEngine/commit/61c9b9782dc62f37b3bfc81febea3dbec406f157))
9
12
 
10
13
 
11
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/playerutils",
3
- "version": "8.13.1-canary.522.b5d379b.0",
3
+ "version": "8.14.0",
4
4
  "description": "Player utility functions",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -28,12 +28,12 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@quenty/brio": "14.13.1-canary.522.b5d379b.0",
32
- "@quenty/instanceutils": "13.13.1-canary.522.b5d379b.0",
33
- "@quenty/loader": "10.7.1",
34
- "@quenty/maid": "3.4.0",
35
- "@quenty/promise": "10.8.0",
36
- "@quenty/rx": "13.13.1-canary.522.b5d379b.0"
31
+ "@quenty/brio": "^14.14.0",
32
+ "@quenty/instanceutils": "^13.14.0",
33
+ "@quenty/loader": "^10.7.1",
34
+ "@quenty/maid": "^3.4.0",
35
+ "@quenty/promise": "^10.8.0",
36
+ "@quenty/rx": "^13.14.0"
37
37
  },
38
- "gitHead": "b5d379b3553fb94b954870562e1bd2a57e9a1c10"
38
+ "gitHead": "66190e48c1ca93b07040326e9cfcf97e8eb4b0e1"
39
39
  }
@@ -42,7 +42,7 @@ end
42
42
  @param displayName string
43
43
  @return string -- Formatted name
44
44
  ]=]
45
- function PlayerUtils.formatDisplayName(name, displayName)
45
+ function PlayerUtils.formatDisplayName(name: string, displayName: string): string
46
46
  if string.lower(name) == string.lower(displayName) then
47
47
  return displayName
48
48
  else
@@ -50,6 +50,35 @@ function PlayerUtils.formatDisplayName(name, displayName)
50
50
  end
51
51
  end
52
52
 
53
+ --[=[
54
+ Formats the display name from the user info
55
+ @param userInfo UserInfo
56
+ @return string
57
+ ]=]
58
+ function PlayerUtils.formatDisplayNameFromUserInfo(userInfo): string
59
+ assert(type(userInfo) == "table", "Bad userInfo")
60
+ assert(type(userInfo.Username) == "string", "Bad userInfo.Username")
61
+ assert(type(userInfo.DisplayName) == "string", "Bad userInfo.DisplayName")
62
+
63
+ local result = PlayerUtils.formatDisplayName(userInfo.Username, userInfo.DisplayName)
64
+
65
+ if userInfo.HasVerifiedBadge then
66
+ return PlayerUtils.addVerifiedBadgeToName(result)
67
+ end
68
+
69
+ return result
70
+ end
71
+
72
+ --[=[
73
+ Adds verified badges to the name
74
+
75
+ @param name string
76
+ @return string
77
+ ]=]
78
+ function PlayerUtils.addVerifiedBadgeToName(name: string): string
79
+ return string.format("%s %s", name, utf8.char(0xE000))
80
+ end
81
+
53
82
  local NAME_COLORS = {
54
83
  BrickColor.new("Bright red").Color;
55
84
  BrickColor.new("Bright blue").Color;