@quenty/attributeutils 4.0.1 → 4.0.3-canary.241.f6a9a6a.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,6 +3,25 @@
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
+ ## [4.0.3-canary.241.f6a9a6a.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/attributeutils@4.0.2...@quenty/attributeutils@4.0.3-canary.241.f6a9a6a.0) (2022-01-03)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add AttributeUtils.initAttribute(instance, attributeName, default) ([232e62c](https://github.com/Quenty/NevermoreEngine/commit/232e62cc51a5b8b9310664be6d3013f26d2c8842))
12
+
13
+
14
+
15
+
16
+
17
+ ## [4.0.2](https://github.com/Quenty/NevermoreEngine/compare/@quenty/attributeutils@4.0.1...@quenty/attributeutils@4.0.2) (2021-12-30)
18
+
19
+ **Note:** Version bump only for package @quenty/attributeutils
20
+
21
+
22
+
23
+
24
+
6
25
  ## [4.0.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/attributeutils@4.0.0...@quenty/attributeutils@4.0.1) (2021-12-30)
7
26
 
8
27
  **Note:** Version bump only for package @quenty/attributeutils
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/attributeutils",
3
- "version": "4.0.1",
3
+ "version": "4.0.3-canary.241.f6a9a6a.0",
4
4
  "description": "Provides utility functions to work with attributes in Roblox",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -25,12 +25,12 @@
25
25
  "Quenty"
26
26
  ],
27
27
  "dependencies": {
28
- "@quenty/loader": "^3.1.2",
29
- "@quenty/maid": "^2.0.2",
30
- "@quenty/rx": "^3.5.1"
28
+ "@quenty/loader": "3.1.3-canary.241.f6a9a6a.0",
29
+ "@quenty/maid": "2.0.2",
30
+ "@quenty/rx": "3.5.3-canary.241.f6a9a6a.0"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "gitHead": "d146c77d0a8e452824de0ab0b4b03ba0370bcc1b"
35
+ "gitHead": "f6a9a6aa7c5f61f5a686faf305359828d8912fc0"
36
36
  }
@@ -77,4 +77,21 @@ function AttributeUtils.bindToBinder(instance, attributeName, binder)
77
77
  return maid
78
78
  end
79
79
 
80
+ --[=[
81
+ Initializes an attribute for a given instance
82
+
83
+ @param instance Instance
84
+ @param attributeName string
85
+ @param default any
86
+ @return any? -- The value of the attribute
87
+ ]=]
88
+ function AttributeUtils.initAttribute(instance, attributeName, default)
89
+ local value = instance:GetAttribute(attributeName)
90
+ if value == nil then
91
+ instance:SetAttribute(attributeName, default)
92
+ value = default
93
+ end
94
+ return value
95
+ end
96
+
80
97
  return AttributeUtils