@rbxts/covenant 2.0.1 → 2.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/covenant",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "main": "src/init.luau",
5
5
  "scripts": {
6
6
  "build": "rbxtsc",
package/src/helpers.d.ts DELETED
@@ -1,21 +0,0 @@
1
- import { Discriminator } from "./hooks";
2
-
3
- export declare function turnArrayWithIdentifierToMap<T extends defined>(
4
- array: ReadonlyArray<T>,
5
- getIdentifier: (state: T) => Discriminator,
6
- ): Map<defined, T>;
7
- export declare function compareMaps<TKey extends Discriminator, TValue extends defined>(
8
- previousMap: ReadonlyMap<TKey, TValue>,
9
- newMap: ReadonlyMap<TKey, TValue>,
10
- ): {
11
- entriesAdded: {
12
- key: TKey;
13
- value: TValue;
14
- }[];
15
- entriesChanged: {
16
- key: TKey;
17
- value: TValue;
18
- previousValue: TValue;
19
- }[];
20
- keysRemoved: TKey[];
21
- };
package/src/helpers.luau DELETED
@@ -1,71 +0,0 @@
1
- -- Compiled with roblox-ts v3.0.0
2
- -- Manually modified
3
- local function turnArrayWithIdentifierToMap(array, getIdentifier)
4
- local newMap = {}
5
- -- ▼ ReadonlyArray.forEach ▼
6
- local _callback = function(value)
7
- local identifier = getIdentifier(value)
8
- local _value = value
9
- newMap[identifier] = _value
10
- end
11
- for _k, _v in array do
12
- _callback(_v)
13
- end
14
- -- ▲ ReadonlyArray.forEach ▲
15
- return newMap
16
- end
17
- local function compareMaps(previousMap, newMap)
18
- local entriesAdded = {}
19
- local entriesChanged = {}
20
- local keysRemoved = {}
21
- -- ▼ ReadonlyMap.forEach ▼
22
- local _callback = function(value, key)
23
- local _previousMap = previousMap
24
- local _key = key
25
- if not (_previousMap[_key] ~= nil) then
26
- local _arg0 = {
27
- key = key,
28
- value = value,
29
- }
30
- table.insert(entriesAdded, _arg0)
31
- else
32
- local _previousMap_1 = previousMap
33
- local _key_1 = key
34
- local previousValue = _previousMap_1[_key_1]
35
- if previousValue ~= value then
36
- local _arg0 = {
37
- key = key,
38
- value = value,
39
- previousValue = previousValue,
40
- }
41
- table.insert(entriesChanged, _arg0)
42
- end
43
- end
44
- end
45
- for _k, _v in newMap do
46
- _callback(_v, _k, newMap)
47
- end
48
- -- ▲ ReadonlyMap.forEach ▲
49
- -- ▼ ReadonlyMap.forEach ▼
50
- local _callback_1 = function(_, key)
51
- local _newMap = newMap
52
- local _key = key
53
- if not (_newMap[_key] ~= nil) then
54
- local _key_1 = key
55
- table.insert(keysRemoved, _key_1)
56
- end
57
- end
58
- for _k, _v in previousMap do
59
- _callback_1(_v, _k, previousMap)
60
- end
61
- -- ▲ ReadonlyMap.forEach ▲
62
- return {
63
- entriesAdded = entriesAdded,
64
- entriesChanged = entriesChanged,
65
- keysRemoved = keysRemoved,
66
- }
67
- end
68
- return {
69
- turnArrayWithIdentifierToMap = turnArrayWithIdentifierToMap,
70
- compareMaps = compareMaps,
71
- }