@rbxts/covenant 1.5.13 → 2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/covenant",
3
- "version": "1.5.13",
3
+ "version": "2.0.0",
4
4
  "main": "src/init.luau",
5
5
  "scripts": {
6
6
  "build": "rbxtsc",
package/src/covenant.d.ts CHANGED
@@ -23,8 +23,6 @@ export declare class Covenant {
23
23
  private undefinedStringifiedComponents;
24
24
  private replicatedStringifiedComponents;
25
25
  private predictedStringifiedComponents;
26
- private internalStringifiedComponents;
27
- private prioritizedStringifiedComponents;
28
26
  private started;
29
27
  private stringifiedComponentSubscribers;
30
28
  private stringifiedComponentValidators;
@@ -55,28 +53,22 @@ export declare class Covenant {
55
53
  private worldDelete;
56
54
  worldComponent<T extends defined>(): Entity<T>;
57
55
  worldTag(): Entity<undefined>;
58
- private worldInternalComponent;
59
56
  private checkComponentDefined;
60
57
  private defineComponentNetworkBehavior;
61
- defineComputedComponent<T extends defined>({ component, queriedComponents, recipe, replicated, predictionValidator, }: {
58
+ defineComponent<T extends defined>({ component, queriedComponents, recipe, replicated, predictionValidator, }: {
62
59
  replicated: boolean;
63
60
  predictionValidator: ComponentPredictionValidator | false;
64
61
  component: Entity<T>;
65
62
  queriedComponents: Entity[][];
66
63
  recipe: (entity: Entity, lastState: T | undefined, updateId: number, hooks: CovenantHooks) => T | undefined;
67
64
  }): void;
68
- defineManagedChildren<T extends defined>({ childIdentityComponent, getIdentifier, queriedComponents, recipe, replicated, predictionValidator, }: {
69
- replicated: boolean;
70
- predictionValidator: ComponentPredictionValidator | false;
71
- childIdentityComponent: Entity<T>;
72
- getIdentifier: (state: T) => Discriminator;
73
- queriedComponents: Entity[][];
74
- recipe: (entity: Entity, lastChildrenStates: ReadonlySet<T>, updateId: number, hooks: CovenantHooks) => ReadonlySet<T>;
75
- }): void;
76
- defineStaticEntity<T extends defined>({ identityComponent, recipe, replicated, }: {
65
+ defineIdentity<T extends Discriminator>({ identityComponent, recipe, replicated, }: {
77
66
  replicated: boolean;
78
67
  identityComponent: Entity<T>;
79
- recipe: () => T[];
68
+ recipe: (entities: ReadonlyMap<T, Entity>, updateId: number, hooks: CovenantHooks) => {
69
+ statesToCreate?: T[];
70
+ statesToDelete?: T[];
71
+ };
80
72
  }): void;
81
73
  private worldEntity;
82
74
  worldQuery<T extends Id[]>(...components: T): import("@rbxts/jecs").Query<import("@rbxts/jecs").InferComponents<T>>;
package/src/covenant.luau CHANGED
@@ -12,9 +12,6 @@ local createHooks = TS.import(script, script.Parent, "hooks").createHooks
12
12
  local _stringEnums = TS.import(script, script.Parent, "stringEnums")
13
13
  local Remove = _stringEnums.Remove
14
14
  local Delete = _stringEnums.Delete
15
- local _helpers = TS.import(script, script.Parent, "helpers")
16
- local compareMaps = _helpers.compareMaps
17
- local turnSetWithIdentifierToMap = _helpers.turnSetWithIdentifierToMap
18
15
  local EventMap = TS.import(script, script.Parent, "dataStructureWithEvents").EventMap
19
16
  local BIG_PRIORITY = 10000000
20
17
  for _k, _v in TS.import(script, TS.getModule(script, "@rbxts", "jecs").jecs) or {} do
@@ -60,8 +57,6 @@ do
60
57
  self.undefinedStringifiedComponents = {}
61
58
  self.replicatedStringifiedComponents = {}
62
59
  self.predictedStringifiedComponents = {}
63
- self.internalStringifiedComponents = {}
64
- self.prioritizedStringifiedComponents = {}
65
60
  self.started = false
66
61
  self.stringifiedComponentSubscribers = {}
67
62
  self.stringifiedComponentValidators = {}
@@ -155,49 +150,12 @@ do
155
150
  local worldReconciliation = {}
156
151
  -- ▼ ReadonlyMap.forEach ▼
157
152
  local _callback_1 = function(componentChanges, stringifiedComponent)
158
- local _prioritizedStringifiedComponents = self.prioritizedStringifiedComponents
159
- local _stringifiedComponent = stringifiedComponent
160
- if not (_prioritizedStringifiedComponents[_stringifiedComponent] ~= nil) then
161
- return nil
162
- end
163
153
  self:forEachComponentChanges(player, worldReconciliation, componentChanges, stringifiedComponent)
164
154
  end
165
155
  for _k, _v in worldChanges do
166
156
  _callback_1(_v, _k, worldChanges)
167
157
  end
168
158
  -- ▲ ReadonlyMap.forEach ▲
169
- -- ▼ ReadonlyMap.forEach ▼
170
- local _callback_2 = function(componentChanges, stringifiedComponent)
171
- local _internalStringifiedComponents = self.internalStringifiedComponents
172
- local _stringifiedComponent = stringifiedComponent
173
- local _condition = not (_internalStringifiedComponents[_stringifiedComponent] ~= nil)
174
- if _condition then
175
- local _prioritizedStringifiedComponents = self.prioritizedStringifiedComponents
176
- local _stringifiedComponent_1 = stringifiedComponent
177
- _condition = _prioritizedStringifiedComponents[_stringifiedComponent_1] ~= nil
178
- end
179
- if _condition then
180
- return nil
181
- end
182
- self:forEachComponentChanges(player, worldReconciliation, componentChanges, stringifiedComponent)
183
- end
184
- for _k, _v in worldChanges do
185
- _callback_2(_v, _k, worldChanges)
186
- end
187
- -- ▲ ReadonlyMap.forEach ▲
188
- -- ▼ ReadonlyMap.forEach ▼
189
- local _callback_3 = function(componentChanges, stringifiedComponent)
190
- local _internalStringifiedComponents = self.internalStringifiedComponents
191
- local _stringifiedComponent = stringifiedComponent
192
- if _internalStringifiedComponents[_stringifiedComponent] ~= nil then
193
- return nil
194
- end
195
- self:forEachComponentChanges(player, worldReconciliation, componentChanges, stringifiedComponent)
196
- end
197
- for _k, _v in worldChanges do
198
- _callback_3(_v, _k, worldChanges)
199
- end
200
- -- ▲ ReadonlyMap.forEach ▲
201
159
  if not (next(worldReconciliation) == nil) then
202
160
  self.replicationSend(player, worldReconciliation)
203
161
  end
@@ -295,11 +253,6 @@ do
295
253
  end
296
254
  -- ▼ ReadonlyMap.forEach ▼
297
255
  local _callback_2 = function(state, stringifiedComponent)
298
- local _prioritizedStringifiedComponents = self.prioritizedStringifiedComponents
299
- local _stringifiedComponent = stringifiedComponent
300
- if not (_prioritizedStringifiedComponents[_stringifiedComponent] ~= nil) then
301
- return nil
302
- end
303
256
  local component = tonumber(stringifiedComponent)
304
257
  if state == Remove then
305
258
  self:worldSet(entity, component, nil, true)
@@ -311,48 +264,6 @@ do
311
264
  _callback_2(_v, _k, entityData)
312
265
  end
313
266
  -- ▲ ReadonlyMap.forEach ▲
314
- -- ▼ ReadonlyMap.forEach ▼
315
- local _callback_3 = function(state, stringifiedComponent)
316
- local _internalStringifiedComponents = self.internalStringifiedComponents
317
- local _stringifiedComponent = stringifiedComponent
318
- local _condition = not (_internalStringifiedComponents[_stringifiedComponent] ~= nil)
319
- if _condition then
320
- local _prioritizedStringifiedComponents = self.prioritizedStringifiedComponents
321
- local _stringifiedComponent_1 = stringifiedComponent
322
- _condition = _prioritizedStringifiedComponents[_stringifiedComponent_1] ~= nil
323
- end
324
- if _condition then
325
- return nil
326
- end
327
- local component = tonumber(stringifiedComponent)
328
- if state == Remove then
329
- self:worldSet(entity, component, nil, true)
330
- else
331
- self:worldSet(entity, component, state, true)
332
- end
333
- end
334
- for _k, _v in entityData do
335
- _callback_3(_v, _k, entityData)
336
- end
337
- -- ▲ ReadonlyMap.forEach ▲
338
- -- ▼ ReadonlyMap.forEach ▼
339
- local _callback_4 = function(state, stringifiedComponent)
340
- local _internalStringifiedComponents = self.internalStringifiedComponents
341
- local _stringifiedComponent = stringifiedComponent
342
- if _internalStringifiedComponents[_stringifiedComponent] ~= nil then
343
- return nil
344
- end
345
- local component = tonumber(stringifiedComponent)
346
- if state == Remove then
347
- self:worldSet(entity, component, nil, true)
348
- else
349
- self:worldSet(entity, component, state, true)
350
- end
351
- end
352
- for _k, _v in entityData do
353
- _callback_4(_v, _k, entityData)
354
- end
355
- -- ▲ ReadonlyMap.forEach ▲
356
267
  end
357
268
  for _k, _v in worldChanges do
358
269
  _callback_1(_v, _k, worldChanges)
@@ -450,13 +361,7 @@ do
450
361
  else
451
362
  self._world:set(entity, component, newState)
452
363
  end
453
- local _condition = self.logging and RunService:IsStudio()
454
- if _condition then
455
- local _internalStringifiedComponents = self.internalStringifiedComponents
456
- local _arg0 = tostring(component)
457
- _condition = not (_internalStringifiedComponents[_arg0] ~= nil)
458
- end
459
- if _condition then
364
+ if self.logging and RunService:IsStudio() then
460
365
  print(`{entity}.{component}:{lastState}->{newState}`)
461
366
  end
462
367
  local _stringifiedComponentSubscribers = self.stringifiedComponentSubscribers
@@ -491,20 +396,20 @@ do
491
396
  if entityChanges ~= Delete then
492
397
  local _entityChanges = entityChanges
493
398
  local _exp = tostring(component)
494
- local _condition_1 = newState
495
- if _condition_1 == nil then
496
- _condition_1 = Remove
399
+ local _condition = newState
400
+ if _condition == nil then
401
+ _condition = Remove
497
402
  end
498
- _entityChanges[_exp] = _condition_1
403
+ _entityChanges[_exp] = _condition
499
404
  end
500
405
  end
501
- local _condition_1 = RunService:IsClient()
502
- if _condition_1 then
406
+ local _condition = RunService:IsClient()
407
+ if _condition then
503
408
  local _predictedStringifiedComponents = self.predictedStringifiedComponents
504
409
  local _arg0_2 = tostring(component)
505
- _condition_1 = _predictedStringifiedComponents[_arg0_2] ~= nil
410
+ _condition = _predictedStringifiedComponents[_arg0_2] ~= nil
506
411
  end
507
- if _condition_1 then
412
+ if _condition then
508
413
  local _worldChangesForPrediction = self.worldChangesForPrediction
509
414
  local _arg0_2 = tostring(component)
510
415
  local componentChanges = _worldChangesForPrediction[_arg0_2]
@@ -517,11 +422,11 @@ do
517
422
  end
518
423
  local _componentChanges = componentChanges
519
424
  local _exp = tostring(entity)
520
- local _condition_2 = newState
521
- if _condition_2 == nil then
522
- _condition_2 = Remove
425
+ local _condition_1 = newState
426
+ if _condition_1 == nil then
427
+ _condition_1 = Remove
523
428
  end
524
- _componentChanges[_exp] = _condition_2
429
+ _componentChanges[_exp] = _condition_1
525
430
  end
526
431
  end
527
432
  function Covenant:subscribeComponent(component, subscriber)
@@ -593,19 +498,6 @@ do
593
498
  _undefinedStringifiedComponents[_arg0] = true
594
499
  return c
595
500
  end
596
- function Covenant:worldInternalComponent(prioritized)
597
- self:preventPostStartCall()
598
- local c = self._world:component()
599
- if prioritized then
600
- local _prioritizedStringifiedComponents = self.prioritizedStringifiedComponents
601
- local _arg0 = tostring(c)
602
- _prioritizedStringifiedComponents[_arg0] = true
603
- end
604
- local _internalStringifiedComponents = self.internalStringifiedComponents
605
- local _arg0 = tostring(c)
606
- _internalStringifiedComponents[_arg0] = true
607
- return c
608
- end
609
501
  function Covenant:checkComponentDefined(component)
610
502
  local _undefinedStringifiedComponents = self.undefinedStringifiedComponents
611
503
  local _arg0 = tostring(component)
@@ -632,7 +524,7 @@ do
632
524
  _stringifiedComponentValidators[_arg0_1] = _predictionValidator
633
525
  end
634
526
  end
635
- function Covenant:defineComputedComponent(_param)
527
+ function Covenant:defineComponent(_param)
636
528
  local component = _param.component
637
529
  local queriedComponents = _param.queriedComponents
638
530
  local recipe = _param.recipe
@@ -748,19 +640,12 @@ do
748
640
  updater()
749
641
  end)
750
642
  end
751
- function Covenant:defineManagedChildren(_param)
752
- local childIdentityComponent = _param.childIdentityComponent
753
- local getIdentifier = _param.getIdentifier
754
- local queriedComponents = _param.queriedComponents
643
+ function Covenant:defineIdentity(_param)
644
+ local identityComponent = _param.identityComponent
755
645
  local recipe = _param.recipe
756
646
  local replicated = _param.replicated
757
- local predictionValidator = _param.predictionValidator
758
- self:checkComponentDefined(childIdentityComponent)
759
- local parentEntityTrackerComponent = self:worldInternalComponent(true)
760
- local parentComponent = self:worldInternalComponent()
761
- self:defineComponentNetworkBehavior(parentComponent, replicated, predictionValidator)
762
- self:defineComponentNetworkBehavior(parentEntityTrackerComponent, replicated, false)
763
- local queryParentComponent = self:worldQuery(parentComponent):cached()
647
+ self:checkComponentDefined(identityComponent)
648
+ self:defineComponentNetworkBehavior(identityComponent, replicated, false)
764
649
  local willUpdate = true
765
650
  local function indicateUpdate()
766
651
  willUpdate = true
@@ -771,166 +656,53 @@ do
771
656
  self:subscribeComponent(component, subscriber)
772
657
  end,
773
658
  })
774
- -- ReadonlyArray.map
775
- local _newValue = table.create(#queriedComponents)
776
- local _callback = function(components)
777
- return self:worldQuery(unpack(components)):cached()
778
- end
779
- for _k, _v in queriedComponents do
780
- _newValue[_k] = _callback(_v, _k - 1, queriedComponents)
781
- end
782
- -- ▲ ReadonlyArray.map ▲
783
- local queries = _newValue
784
- local _array = {}
785
- local _length = #_array
786
- -- ▼ ReadonlyArray.reduce ▼
787
- local _result = {}
788
- local _callback_1 = function(accum, components)
789
- -- ▼ ReadonlyArray.forEach ▼
790
- local _callback_2 = function(component)
791
- local stringifiedComponent = tostring(component)
792
- accum[stringifiedComponent] = true
659
+ local entities = {}
660
+ self:subscribeComponent(identityComponent, function(entity, state, prevState)
661
+ if prevState ~= nil then
662
+ local _prevState = prevState
663
+ entities[_prevState] = nil
793
664
  end
794
- for _k, _v in components do
795
- _callback_2(_v, _k - 1, components)
665
+ if state ~= nil then
666
+ local _state = state
667
+ local _entity = entity
668
+ entities[_state] = _entity
796
669
  end
797
- -- ▲ ReadonlyArray.forEach ▲
798
- return accum
799
- end
800
- for _i = 1, #queriedComponents do
801
- _result = _callback_1(_result, queriedComponents[_i], _i - 1, queriedComponents)
802
- end
803
- -- ▲ ReadonlyArray.reduce ▲
804
- for _v in _result do
805
- _length += 1
806
- _array[_length] = _v
807
- end
808
- -- ▼ ReadonlyArray.map ▼
809
- local _newValue_1 = table.create(#_array)
810
- local _callback_2 = function(stringifiedComponent)
811
- return tonumber(stringifiedComponent)
812
- end
813
- for _k, _v in _array do
814
- _newValue_1[_k] = _callback_2(_v, _k - 1, _array)
815
- end
816
- -- ▲ ReadonlyArray.map ▲
817
- -- ▼ ReadonlyArray.forEach ▼
818
- local _callback_3 = function(component)
819
- self:subscribeComponent(component, indicateUpdate)
820
- end
821
- for _k, _v in _newValue_1 do
822
- _callback_3(_v, _k - 1, _newValue_1)
823
- end
824
- -- ▲ ReadonlyArray.forEach ▲
825
- local lastUpdateId = 0
826
- self:subscribeComponent(parentComponent, function(entity, newState, lastState)
827
- local lastStateMap = turnSetWithIdentifierToMap(lastState or {}, getIdentifier)
828
- local newStateMap = turnSetWithIdentifierToMap(newState or {}, getIdentifier)
829
- local entityTracker = self:worldGet(entity, parentEntityTrackerComponent)
830
- if entityTracker == nil then
831
- entityTracker = {}
832
- self:worldSet(entity, parentEntityTrackerComponent, entityTracker)
833
- end
834
- local _binding = compareMaps(lastStateMap, newStateMap)
835
- local entriesChanged = _binding.entriesChanged
836
- local entriesAdded = _binding.entriesAdded
837
- local keysRemoved = _binding.keysRemoved
838
- -- ▼ ReadonlyArray.forEach ▼
839
- local _callback_4 = function(_param_1)
840
- local key = _param_1.key
841
- local value = _param_1.value
842
- local childEntity = entityTracker[key]
843
- if childEntity == nil then
844
- childEntity = self._world:entity()
845
- local _entityTracker = entityTracker
846
- local _childEntity = childEntity
847
- _entityTracker[key] = _childEntity
848
- end
849
- self:worldSet(childEntity, childIdentityComponent, value)
850
- self._world:add(childEntity, pair(ChildOf, entity))
851
- end
852
- for _k, _v in entriesAdded do
853
- _callback_4(_v, _k - 1, entriesAdded)
854
- end
855
- -- ▲ ReadonlyArray.forEach ▲
856
- -- ▼ ReadonlyArray.forEach ▼
857
- local _callback_5 = function(_param_1)
858
- local key = _param_1.key
859
- local value = _param_1.value
860
- local childEntity = entityTracker[key]
861
- local _arg0 = childEntity ~= nil
862
- assert(_arg0)
863
- self:worldSet(childEntity, childIdentityComponent, value)
864
- end
865
- for _k, _v in entriesChanged do
866
- _callback_5(_v, _k - 1, entriesChanged)
867
- end
868
- -- ▲ ReadonlyArray.forEach ▲
869
- -- ▼ ReadonlyArray.forEach ▼
870
- local _callback_6 = function(key)
871
- local _entityTracker = entityTracker
872
- local _key = key
873
- local childEntity = _entityTracker[_key]
874
- local _arg0 = childEntity ~= nil
875
- assert(_arg0)
876
- self:worldDelete(childEntity)
877
- local _entityTracker_1 = entityTracker
878
- local _key_1 = key
879
- _entityTracker_1[_key_1] = nil
880
- end
881
- for _k, _v in keysRemoved do
882
- _callback_6(_v, _k - 1, keysRemoved)
883
- end
884
- -- ▲ ReadonlyArray.forEach ▲
885
670
  end)
671
+ local lastUpdateId = 0
886
672
  local updater = function()
887
673
  lastUpdateId += 1
888
674
  local updateId = lastUpdateId
889
- local unhandledStringifiedEntities = {}
890
- local handledStringifiedEntities = {}
891
- for entity in queryParentComponent do
892
- local _arg0 = tostring(entity)
893
- unhandledStringifiedEntities[_arg0] = true
894
- end
895
- -- ReadonlyArray.forEach
896
- local _callback_4 = function(query)
897
- for entity in query do
898
- local stringifiedEntity = tostring(entity)
899
- if handledStringifiedEntities[stringifiedEntity] ~= nil then
900
- continue
901
- end
902
- handledStringifiedEntities[stringifiedEntity] = true
903
- unhandledStringifiedEntities[stringifiedEntity] = nil
904
- local lastState = self:worldGet(entity, parentComponent) or {}
905
- local newState = recipe(entity, lastState, updateId, hooks)
906
- self:worldSet(entity, parentComponent, newState)
675
+ local _binding = recipe(entities, updateId, hooks)
676
+ local statesToCreate = _binding.statesToCreate
677
+ local statesToDelete = _binding.statesToDelete
678
+ local _result = statesToCreate
679
+ if _result ~= nil then
680
+ -- ▼ ReadonlyArray.forEach ▼
681
+ local _callback = function(state)
682
+ local entity = self:worldEntity()
683
+ self:worldSet(entity, identityComponent, state)
907
684
  end
685
+ for _k, _v in _result do
686
+ _callback(_v, _k - 1, _result)
687
+ end
688
+ -- ▲ ReadonlyArray.forEach ▲
908
689
  end
909
- for _k, _v in queries do
910
- _callback_4(_v, _k - 1, queries)
911
- end
912
- -- ReadonlyArray.forEach
913
- -- ReadonlySet.forEach
914
- local _callback_5 = function(stringifiedEntity)
915
- local entity = tonumber(stringifiedEntity)
916
- local children = self:worldGet(entity, parentEntityTrackerComponent)
917
- if children ~= nil then
918
- -- ▼ ReadonlyMap.forEach ▼
919
- local _callback_6 = function(childEntity)
920
- self:worldDelete(childEntity)
921
- end
922
- for _k, _v in children do
923
- _callback_6(_v, _k, children)
690
+ local _result_1 = statesToDelete
691
+ if _result_1 ~= nil then
692
+ -- ▼ ReadonlyArray.forEach ▼
693
+ local _callback = function(state)
694
+ local _state = state
695
+ local entity = entities[_state]
696
+ if entity == nil then
697
+ return nil
924
698
  end
925
- -- ▲ ReadonlyMap.forEach ▲
699
+ self:worldDelete(entity)
926
700
  end
927
- self:worldSet(entity, parentComponent, nil)
928
- self:worldSet(entity, parentEntityTrackerComponent, nil)
929
- end
930
- for _v in unhandledStringifiedEntities do
931
- _callback_5(_v, _v, unhandledStringifiedEntities)
701
+ for _k, _v in _result_1 do
702
+ _callback(_v, _k - 1, _result_1)
703
+ end
704
+ -- ReadonlyArray.forEach
932
705
  end
933
- -- ▲ ReadonlySet.forEach ▲
934
706
  end
935
707
  self:schedule(RunService.Heartbeat, function()
936
708
  if not willUpdate then
@@ -940,23 +712,6 @@ do
940
712
  updater()
941
713
  end)
942
714
  end
943
- function Covenant:defineStaticEntity(_param)
944
- local identityComponent = _param.identityComponent
945
- local recipe = _param.recipe
946
- local replicated = _param.replicated
947
- self:checkComponentDefined(identityComponent)
948
- self:defineComponentNetworkBehavior(identityComponent, replicated, false)
949
- local states = recipe()
950
- -- ▼ ReadonlyArray.forEach ▼
951
- local _callback = function(state)
952
- local entity = self:worldEntity()
953
- self:worldSet(entity, identityComponent, state)
954
- end
955
- for _k, _v in states do
956
- _callback(_v, _k - 1, states)
957
- end
958
- -- ▲ ReadonlyArray.forEach ▲
959
- end
960
715
  function Covenant:worldEntity()
961
716
  return self._world:entity()
962
717
  end
package/src/helpers.d.ts CHANGED
@@ -1,13 +1,10 @@
1
1
  import { Discriminator } from "./hooks";
2
2
 
3
- export declare function turnSetWithIdentifierToMap<T extends defined>(
4
- set: ReadonlySet<T>,
3
+ export declare function turnArrayWithIdentifierToMap<T extends defined>(
4
+ array: ReadonlyArray<T>,
5
5
  getIdentifier: (state: T) => Discriminator,
6
6
  ): Map<defined, T>;
7
- export declare function compareMaps<
8
- TKey extends Discriminator,
9
- TValue extends defined,
10
- >(
7
+ export declare function compareMaps<TKey extends Discriminator, TValue extends defined>(
11
8
  previousMap: ReadonlyMap<TKey, TValue>,
12
9
  newMap: ReadonlyMap<TKey, TValue>,
13
10
  ): {
package/src/helpers.luau CHANGED
@@ -1,6 +1,6 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  -- Manually modified
3
- local function turnSetWithIdentifierToMap(set, getIdentifier)
3
+ local function turnArrayWithIdentifierToMap(array, getIdentifier)
4
4
  local newMap = {}
5
5
  -- ▼ ReadonlyArray.forEach ▼
6
6
  local _callback = function(value)
@@ -8,7 +8,7 @@ local function turnSetWithIdentifierToMap(set, getIdentifier)
8
8
  local _value = value
9
9
  newMap[identifier] = _value
10
10
  end
11
- for _v, _ in set do
11
+ for _k, _v in array do
12
12
  _callback(_v)
13
13
  end
14
14
  -- ▲ ReadonlyArray.forEach ▲
@@ -66,6 +66,6 @@ local function compareMaps(previousMap, newMap)
66
66
  }
67
67
  end
68
68
  return {
69
- turnSetWithIdentifierToMap = turnSetWithIdentifierToMap,
69
+ turnArrayWithIdentifierToMap = turnArrayWithIdentifierToMap,
70
70
  compareMaps = compareMaps,
71
71
  }