@quenty/attributeutils 4.0.0 → 4.0.1-canary.238.2c4d310.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,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
+ ## [4.0.1-canary.238.2c4d310.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/attributeutils@4.0.0...@quenty/attributeutils@4.0.1-canary.238.2c4d310.0) (2021-12-29)
7
+
8
+ **Note:** Version bump only for package @quenty/attributeutils
9
+
10
+
11
+
12
+
13
+
6
14
  # [4.0.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/attributeutils@3.6.0...@quenty/attributeutils@4.0.0) (2021-12-22)
7
15
 
8
16
 
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  ## AttributeUtils
2
2
  <div align="center">
3
- <a href="http://quenty.github.io/api/">
3
+ <a href="http://quenty.github.io/NevermoreEngine/">
4
4
  <img src="https://img.shields.io/badge/docs-website-green.svg" alt="Documentation" />
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" />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quenty/attributeutils",
3
- "version": "4.0.0",
3
+ "version": "4.0.1-canary.238.2c4d310.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.1",
29
- "@quenty/maid": "^2.0.1",
30
- "@quenty/rx": "^3.5.0"
28
+ "@quenty/loader": "3.1.2-canary.238.2c4d310.0",
29
+ "@quenty/maid": "2.0.2-canary.238.2c4d310.0",
30
+ "@quenty/rx": "3.5.1-canary.238.2c4d310.0"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "gitHead": "3a3d03785e31c5b53d27d1fff519a53c695fbc19"
35
+ "gitHead": "2c4d310b84afd0570d89667dc5d4aa69a0ef304a"
36
36
  }
@@ -1,6 +1,7 @@
1
- --- Provides utility functions to work with attributes in Roblox
2
- -- @module AttributeUtils
3
- -- @author Quenty
1
+ --[=[
2
+ Provides utility functions to work with attributes in Roblox
3
+ @class AttributeUtils
4
+ ]=]
4
5
 
5
6
  local require = require(script.Parent.loader).load(script)
6
7
 
@@ -10,6 +11,15 @@ local Maid = require("Maid")
10
11
 
11
12
  local AttributeUtils = {}
12
13
 
14
+ --[=[
15
+ Whenever the attribute is true, the binder will be bound, and when the
16
+ binder is bound, the attribute will be true.
17
+
18
+ @param instance Instance
19
+ @param attributeName string
20
+ @param binder Binder<T>
21
+ @return Maid
22
+ ]=]
13
23
  function AttributeUtils.bindToBinder(instance, attributeName, binder)
14
24
  assert(binder, "Bad binder")
15
25
  assert(typeof(instance) == "Instance", "Bad instance")
@@ -1,11 +1,35 @@
1
- ---
2
- -- @classmod AttributeValue
3
- -- @author Quenty
1
+ --[=[
2
+ Allows access to an attribute like a ValueObject.
3
+
4
+ ```lua
5
+ local attributeValue = AttributeValue.new(workspace, "Version", "1.0.0")
6
+ print(attributeValue.Value) --> 1.0.0
7
+ print(workspace:GetAttribute("version")) --> 1.0.0
8
+
9
+ attributeValue.Changed:Connect(function()
10
+ print(attributeValue.Value)
11
+ end)
12
+
13
+ workspace:SetAttribute("1.1.0") --> 1.1.0
14
+ attributeValue.Value = "1.2.0" --> 1.2.0
15
+ ```
16
+
17
+ @class AttributeValue
18
+ ]=]
4
19
 
5
20
  local AttributeValue = {}
6
21
  AttributeValue.ClassName = "AttributeValue"
7
22
  AttributeValue.__index = AttributeValue
8
23
 
24
+ --[=[
25
+ Constructs a new AttributeValue. If a defaultValue that is not nil
26
+ is defined, then this value will be set on the Roblox object.
27
+
28
+ @param object Instance
29
+ @param attributeName string
30
+ @param defaultValue T?
31
+ @return AttributeValue<T>
32
+ ]=]
9
33
  function AttributeValue.new(object, attributeName, defaultValue)
10
34
  assert(typeof(object) == "Instance", "Bad object")
11
35
  assert(type(attributeName) == "string", "Bad attributeName")
@@ -23,6 +47,19 @@ function AttributeValue.new(object, attributeName, defaultValue)
23
47
  return setmetatable(self, AttributeValue)
24
48
  end
25
49
 
50
+ --[=[
51
+ The current property of the Attribute. Can be assigned to to write
52
+ the attribute.
53
+ @prop Value T
54
+ @within AttributeValue
55
+ ]=]
56
+
57
+ --[=[
58
+ Signal that fires when the attribute changes
59
+ @readonly
60
+ @prop Changed Signal<()>
61
+ @within AttributeValue
62
+ ]=]
26
63
  function AttributeValue:__index(index)
27
64
  if index == "Value" then
28
65
  local result = self._object:GetAttribute(rawget(self, "_attributeName"))
@@ -1,6 +1,7 @@
1
- ---
2
- -- @module RxAttributeUtils
3
- -- @author Quenty
1
+ --[=[
2
+ Utility functions involving attributes.
3
+ @class RxAttributeUtils
4
+ ]=]
4
5
 
5
6
  local require = require(script.Parent.loader).load(script)
6
7
 
@@ -9,6 +10,13 @@ local Maid = require("Maid")
9
10
 
10
11
  local RxAttributeUtils = {}
11
12
 
13
+ --[=[
14
+ Observes an attribute on an instance.
15
+ @param instance Instance
16
+ @param attributeName string
17
+ @param defaultValue any?
18
+ @return Observable<any>
19
+ ]=]
12
20
  function RxAttributeUtils.observeAttribute(instance, attributeName, defaultValue)
13
21
  assert(typeof(instance) == "Instance", "Bad instance")
14
22
  assert(type(attributeName) == "string", "Bad attributeName")