isaacscript-common 87.2.2 → 87.4.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/dist/functions/decorators.d.ts.map +1 -1
- package/dist/functions/math.d.ts +1 -1
- package/dist/functions/math.js +1 -1
- package/dist/functions/math.lua +1 -1
- package/dist/functions/stats.js +1 -1
- package/dist/functions/stats.lua +1 -1
- package/dist/functions/string.d.ts +1 -1
- package/dist/functions/string.js +1 -1
- package/dist/functions/string.lua +1 -1
- package/dist/functions/utils.d.ts +11 -0
- package/dist/functions/utils.d.ts.map +1 -1
- package/dist/functions/utils.js +20 -1
- package/dist/functions/utils.lua +16 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.rollup.d.ts +17 -6
- package/dist/indexLua.d.ts +1 -0
- package/dist/indexLua.d.ts.map +1 -1
- package/dist/indexLua.js +1 -0
- package/dist/isaacscript-common.lua +406 -254
- package/dist/lualib_bundle.lua +215 -181
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/types/ObjectValues.d.ts +2 -0
- package/dist/types/ObjectValues.d.ts.map +1 -0
- package/dist/types/ObjectValues.js +2 -0
- package/dist/types/ObjectValues.lua +2 -0
- package/dist/types/TupleToIntersection.d.ts +1 -4
- package/dist/types/TupleToIntersection.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/functions/math.ts +1 -1
- package/src/functions/stats.ts +1 -1
- package/src/functions/string.ts +1 -1
- package/src/functions/utils.ts +29 -0
- package/src/index.ts +1 -0
- package/src/types/ObjectValues.ts +1 -0
- package/src/types/TupleToIntersection.ts +4 -6
package/dist/lualib_bundle.lua
CHANGED
|
@@ -588,6 +588,12 @@ local function __TS__ArrayWith(self, index, value)
|
|
|
588
588
|
return copy
|
|
589
589
|
end
|
|
590
590
|
|
|
591
|
+
local function __TS__New(target, ...)
|
|
592
|
+
local instance = setmetatable({}, target.prototype)
|
|
593
|
+
instance:____constructor(...)
|
|
594
|
+
return instance
|
|
595
|
+
end
|
|
596
|
+
|
|
591
597
|
local function __TS__InstanceOf(obj, classTbl)
|
|
592
598
|
if type(classTbl) ~= "table" then
|
|
593
599
|
error("Right-hand side of 'instanceof' is not an object", 0)
|
|
@@ -607,12 +613,6 @@ local function __TS__InstanceOf(obj, classTbl)
|
|
|
607
613
|
return false
|
|
608
614
|
end
|
|
609
615
|
|
|
610
|
-
local function __TS__New(target, ...)
|
|
611
|
-
local instance = setmetatable({}, target.prototype)
|
|
612
|
-
instance:____constructor(...)
|
|
613
|
-
return instance
|
|
614
|
-
end
|
|
615
|
-
|
|
616
616
|
local function __TS__Class(self)
|
|
617
617
|
local c = {prototype = {}}
|
|
618
618
|
c.prototype.__index = c.prototype
|
|
@@ -620,35 +620,27 @@ local function __TS__Class(self)
|
|
|
620
620
|
return c
|
|
621
621
|
end
|
|
622
622
|
|
|
623
|
-
local function __TS__FunctionBind(fn, ...)
|
|
624
|
-
local boundArgs = {...}
|
|
625
|
-
return function(____, ...)
|
|
626
|
-
local args = {...}
|
|
627
|
-
__TS__ArrayUnshift(
|
|
628
|
-
args,
|
|
629
|
-
__TS__Unpack(boundArgs)
|
|
630
|
-
)
|
|
631
|
-
return fn(__TS__Unpack(args))
|
|
632
|
-
end
|
|
633
|
-
end
|
|
634
|
-
|
|
635
623
|
local __TS__Promise
|
|
636
624
|
do
|
|
637
|
-
local function
|
|
625
|
+
local function makeDeferredPromiseFactory()
|
|
638
626
|
local resolve
|
|
639
627
|
local reject
|
|
640
|
-
local
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
628
|
+
local function executor(____, res, rej)
|
|
629
|
+
resolve = res
|
|
630
|
+
reject = rej
|
|
631
|
+
end
|
|
632
|
+
return function()
|
|
633
|
+
local promise = __TS__New(__TS__Promise, executor)
|
|
634
|
+
return promise, resolve, reject
|
|
635
|
+
end
|
|
648
636
|
end
|
|
649
|
-
local
|
|
650
|
-
|
|
637
|
+
local makeDeferredPromise = makeDeferredPromiseFactory()
|
|
638
|
+
local function isPromiseLike(value)
|
|
639
|
+
return __TS__InstanceOf(value, __TS__Promise)
|
|
651
640
|
end
|
|
641
|
+
local function doNothing(self)
|
|
642
|
+
end
|
|
643
|
+
local ____pcall = _G.pcall
|
|
652
644
|
__TS__Promise = __TS__Class()
|
|
653
645
|
__TS__Promise.name = "__TS__Promise"
|
|
654
646
|
function __TS__Promise.prototype.____constructor(self, executor)
|
|
@@ -656,206 +648,177 @@ do
|
|
|
656
648
|
self.fulfilledCallbacks = {}
|
|
657
649
|
self.rejectedCallbacks = {}
|
|
658
650
|
self.finallyCallbacks = {}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
end
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
__TS__FunctionBind(self.reject, self)
|
|
668
|
-
)
|
|
669
|
-
end)
|
|
670
|
-
if not ____try then
|
|
671
|
-
____catch(____hasReturned)
|
|
672
|
-
end
|
|
651
|
+
local success, ____error = ____pcall(
|
|
652
|
+
executor,
|
|
653
|
+
nil,
|
|
654
|
+
function(____, v) return self:resolve(v) end,
|
|
655
|
+
function(____, err) return self:reject(err) end
|
|
656
|
+
)
|
|
657
|
+
if not success then
|
|
658
|
+
self:reject(____error)
|
|
673
659
|
end
|
|
674
660
|
end
|
|
675
|
-
function __TS__Promise.resolve(
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
)
|
|
661
|
+
function __TS__Promise.resolve(value)
|
|
662
|
+
if __TS__InstanceOf(value, __TS__Promise) then
|
|
663
|
+
return value
|
|
664
|
+
end
|
|
665
|
+
local promise = __TS__New(__TS__Promise, doNothing)
|
|
681
666
|
promise.state = 1
|
|
682
|
-
promise.value =
|
|
667
|
+
promise.value = value
|
|
683
668
|
return promise
|
|
684
669
|
end
|
|
685
670
|
function __TS__Promise.reject(reason)
|
|
686
|
-
local promise = __TS__New(
|
|
687
|
-
__TS__Promise,
|
|
688
|
-
function()
|
|
689
|
-
end
|
|
690
|
-
)
|
|
671
|
+
local promise = __TS__New(__TS__Promise, doNothing)
|
|
691
672
|
promise.state = 2
|
|
692
673
|
promise.rejectionReason = reason
|
|
693
674
|
return promise
|
|
694
675
|
end
|
|
695
676
|
__TS__Promise.prototype["then"] = function(self, onFulfilled, onRejected)
|
|
696
|
-
local
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
if isFulfilled then
|
|
707
|
-
internalCallback(nil, self.value)
|
|
708
|
-
end
|
|
709
|
-
else
|
|
710
|
-
local ____self_fulfilledCallbacks_2 = self.fulfilledCallbacks
|
|
711
|
-
____self_fulfilledCallbacks_2[#____self_fulfilledCallbacks_2 + 1] = function(____, v) return resolve(nil, v) end
|
|
712
|
-
end
|
|
713
|
-
if onRejected then
|
|
714
|
-
local internalCallback = self:createPromiseResolvingCallback(onRejected, resolve, reject)
|
|
715
|
-
local ____self_rejectedCallbacks_3 = self.rejectedCallbacks
|
|
716
|
-
____self_rejectedCallbacks_3[#____self_rejectedCallbacks_3 + 1] = internalCallback
|
|
717
|
-
if isRejected then
|
|
718
|
-
internalCallback(nil, self.rejectionReason)
|
|
719
|
-
end
|
|
720
|
-
else
|
|
721
|
-
local ____self_rejectedCallbacks_4 = self.rejectedCallbacks
|
|
722
|
-
____self_rejectedCallbacks_4[#____self_rejectedCallbacks_4 + 1] = function(____, err) return reject(nil, err) end
|
|
723
|
-
end
|
|
724
|
-
if isFulfilled then
|
|
725
|
-
resolve(nil, self.value)
|
|
677
|
+
local promise, resolve, reject = makeDeferredPromise()
|
|
678
|
+
self:addCallbacks(
|
|
679
|
+
onFulfilled and self:createPromiseResolvingCallback(onFulfilled, resolve, reject) or resolve,
|
|
680
|
+
onRejected and self:createPromiseResolvingCallback(onRejected, resolve, reject) or reject
|
|
681
|
+
)
|
|
682
|
+
return promise
|
|
683
|
+
end
|
|
684
|
+
function __TS__Promise.prototype.addCallbacks(self, fulfilledCallback, rejectedCallback)
|
|
685
|
+
if self.state == 1 then
|
|
686
|
+
return fulfilledCallback(nil, self.value)
|
|
726
687
|
end
|
|
727
|
-
if
|
|
728
|
-
|
|
688
|
+
if self.state == 2 then
|
|
689
|
+
return rejectedCallback(nil, self.rejectionReason)
|
|
729
690
|
end
|
|
730
|
-
|
|
691
|
+
local ____self_fulfilledCallbacks_0 = self.fulfilledCallbacks
|
|
692
|
+
____self_fulfilledCallbacks_0[#____self_fulfilledCallbacks_0 + 1] = fulfilledCallback
|
|
693
|
+
local ____self_rejectedCallbacks_1 = self.rejectedCallbacks
|
|
694
|
+
____self_rejectedCallbacks_1[#____self_rejectedCallbacks_1 + 1] = rejectedCallback
|
|
731
695
|
end
|
|
732
696
|
function __TS__Promise.prototype.catch(self, onRejected)
|
|
733
697
|
return self["then"](self, nil, onRejected)
|
|
734
698
|
end
|
|
735
699
|
function __TS__Promise.prototype.finally(self, onFinally)
|
|
736
700
|
if onFinally then
|
|
737
|
-
local
|
|
738
|
-
|
|
701
|
+
local ____self_finallyCallbacks_2 = self.finallyCallbacks
|
|
702
|
+
____self_finallyCallbacks_2[#____self_finallyCallbacks_2 + 1] = onFinally
|
|
739
703
|
if self.state ~= 0 then
|
|
740
704
|
onFinally(nil)
|
|
741
705
|
end
|
|
742
706
|
end
|
|
743
707
|
return self
|
|
744
708
|
end
|
|
745
|
-
function __TS__Promise.prototype.resolve(self,
|
|
746
|
-
if
|
|
747
|
-
|
|
748
|
-
data,
|
|
709
|
+
function __TS__Promise.prototype.resolve(self, value)
|
|
710
|
+
if isPromiseLike(value) then
|
|
711
|
+
return value:addCallbacks(
|
|
749
712
|
function(____, v) return self:resolve(v) end,
|
|
750
713
|
function(____, err) return self:reject(err) end
|
|
751
714
|
)
|
|
752
|
-
return
|
|
753
715
|
end
|
|
754
716
|
if self.state == 0 then
|
|
755
717
|
self.state = 1
|
|
756
|
-
self.value =
|
|
757
|
-
|
|
758
|
-
callback(nil, data)
|
|
759
|
-
end
|
|
760
|
-
for ____, callback in ipairs(self.finallyCallbacks) do
|
|
761
|
-
callback(nil)
|
|
762
|
-
end
|
|
718
|
+
self.value = value
|
|
719
|
+
return self:invokeCallbacks(self.fulfilledCallbacks, value)
|
|
763
720
|
end
|
|
764
721
|
end
|
|
765
722
|
function __TS__Promise.prototype.reject(self, reason)
|
|
766
723
|
if self.state == 0 then
|
|
767
724
|
self.state = 2
|
|
768
725
|
self.rejectionReason = reason
|
|
769
|
-
|
|
770
|
-
|
|
726
|
+
return self:invokeCallbacks(self.rejectedCallbacks, reason)
|
|
727
|
+
end
|
|
728
|
+
end
|
|
729
|
+
function __TS__Promise.prototype.invokeCallbacks(self, callbacks, value)
|
|
730
|
+
local callbacksLength = #callbacks
|
|
731
|
+
local finallyCallbacks = self.finallyCallbacks
|
|
732
|
+
local finallyCallbacksLength = #finallyCallbacks
|
|
733
|
+
if callbacksLength ~= 0 then
|
|
734
|
+
for i = 1, callbacksLength - 1 do
|
|
735
|
+
callbacks[i](callbacks, value)
|
|
771
736
|
end
|
|
772
|
-
|
|
773
|
-
|
|
737
|
+
if finallyCallbacksLength == 0 then
|
|
738
|
+
return callbacks[callbacksLength](callbacks, value)
|
|
774
739
|
end
|
|
740
|
+
callbacks[callbacksLength](callbacks, value)
|
|
741
|
+
end
|
|
742
|
+
if finallyCallbacksLength ~= 0 then
|
|
743
|
+
for i = 1, finallyCallbacksLength - 1 do
|
|
744
|
+
finallyCallbacks[i](finallyCallbacks)
|
|
745
|
+
end
|
|
746
|
+
return finallyCallbacks[finallyCallbacksLength](finallyCallbacks)
|
|
775
747
|
end
|
|
776
748
|
end
|
|
777
749
|
function __TS__Promise.prototype.createPromiseResolvingCallback(self, f, resolve, reject)
|
|
778
750
|
return function(____, value)
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
end
|
|
783
|
-
local ____try, ____hasReturned = pcall(function()
|
|
784
|
-
self:handleCallbackData(
|
|
785
|
-
f(nil, value),
|
|
786
|
-
resolve,
|
|
787
|
-
reject
|
|
788
|
-
)
|
|
789
|
-
end)
|
|
790
|
-
if not ____try then
|
|
791
|
-
____catch(____hasReturned)
|
|
792
|
-
end
|
|
751
|
+
local success, resultOrError = ____pcall(f, nil, value)
|
|
752
|
+
if not success then
|
|
753
|
+
return reject(nil, resultOrError)
|
|
793
754
|
end
|
|
755
|
+
return self:handleCallbackValue(resultOrError, resolve, reject)
|
|
794
756
|
end
|
|
795
757
|
end
|
|
796
|
-
function __TS__Promise.prototype.
|
|
797
|
-
if isPromiseLike(
|
|
798
|
-
local nextpromise =
|
|
758
|
+
function __TS__Promise.prototype.handleCallbackValue(self, value, resolve, reject)
|
|
759
|
+
if isPromiseLike(value) then
|
|
760
|
+
local nextpromise = value
|
|
799
761
|
if nextpromise.state == 1 then
|
|
800
|
-
resolve(nil, nextpromise.value)
|
|
762
|
+
return resolve(nil, nextpromise.value)
|
|
801
763
|
elseif nextpromise.state == 2 then
|
|
802
|
-
reject(nil, nextpromise.rejectionReason)
|
|
764
|
+
return reject(nil, nextpromise.rejectionReason)
|
|
803
765
|
else
|
|
804
|
-
|
|
766
|
+
return nextpromise:addCallbacks(resolve, reject)
|
|
805
767
|
end
|
|
806
768
|
else
|
|
807
|
-
resolve(nil,
|
|
769
|
+
return resolve(nil, value)
|
|
808
770
|
end
|
|
809
771
|
end
|
|
810
772
|
end
|
|
811
773
|
|
|
812
|
-
local
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
774
|
+
local __TS__AsyncAwaiter, __TS__Await
|
|
775
|
+
do
|
|
776
|
+
local ____coroutine = _G.coroutine or ({})
|
|
777
|
+
local cocreate = ____coroutine.create
|
|
778
|
+
local coresume = ____coroutine.resume
|
|
779
|
+
local costatus = ____coroutine.status
|
|
780
|
+
local coyield = ____coroutine.yield
|
|
781
|
+
function __TS__AsyncAwaiter(generator)
|
|
782
|
+
return __TS__New(
|
|
783
|
+
__TS__Promise,
|
|
784
|
+
function(____, resolve, reject)
|
|
785
|
+
local fulfilled, step, resolved, asyncCoroutine
|
|
786
|
+
function fulfilled(self, value)
|
|
787
|
+
local success, resultOrError = coresume(asyncCoroutine, value)
|
|
788
|
+
if success then
|
|
789
|
+
return step(resultOrError)
|
|
790
|
+
end
|
|
791
|
+
return reject(nil, resultOrError)
|
|
826
792
|
end
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
793
|
+
function step(result)
|
|
794
|
+
if resolved then
|
|
795
|
+
return
|
|
796
|
+
end
|
|
797
|
+
if costatus(asyncCoroutine) == "dead" then
|
|
798
|
+
return resolve(nil, result)
|
|
799
|
+
end
|
|
800
|
+
return __TS__Promise.resolve(result):addCallbacks(fulfilled, reject)
|
|
831
801
|
end
|
|
832
|
-
|
|
833
|
-
|
|
802
|
+
resolved = false
|
|
803
|
+
asyncCoroutine = cocreate(generator)
|
|
804
|
+
local success, resultOrError = coresume(
|
|
805
|
+
asyncCoroutine,
|
|
806
|
+
function(____, v)
|
|
807
|
+
resolved = true
|
|
808
|
+
return __TS__Promise.resolve(v):addCallbacks(resolve, reject)
|
|
809
|
+
end
|
|
810
|
+
)
|
|
811
|
+
if success then
|
|
812
|
+
return step(resultOrError)
|
|
834
813
|
else
|
|
835
|
-
|
|
836
|
-
____self_0["then"](____self_0, fulfilled, reject)
|
|
837
|
-
end
|
|
838
|
-
end
|
|
839
|
-
resolved = false
|
|
840
|
-
asyncCoroutine = coroutine.create(generator)
|
|
841
|
-
local success, resultOrError = coroutine.resume(
|
|
842
|
-
asyncCoroutine,
|
|
843
|
-
function(____, v)
|
|
844
|
-
resolved = true
|
|
845
|
-
local ____self_1 = adopt(nil, v)
|
|
846
|
-
____self_1["then"](____self_1, resolve, reject)
|
|
814
|
+
return reject(nil, resultOrError)
|
|
847
815
|
end
|
|
848
|
-
)
|
|
849
|
-
if success then
|
|
850
|
-
step(nil, resultOrError)
|
|
851
|
-
else
|
|
852
|
-
reject(nil, resultOrError)
|
|
853
816
|
end
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
817
|
+
)
|
|
818
|
+
end
|
|
819
|
+
function __TS__Await(thing)
|
|
820
|
+
return coyield(thing)
|
|
821
|
+
end
|
|
859
822
|
end
|
|
860
823
|
|
|
861
824
|
local function __TS__ClassExtends(target, base)
|
|
@@ -953,20 +916,17 @@ local function __TS__ObjectGetOwnPropertyDescriptor(object, key)
|
|
|
953
916
|
return rawget(metatable, "_descriptors")[key]
|
|
954
917
|
end
|
|
955
918
|
|
|
956
|
-
local
|
|
919
|
+
local __TS__DescriptorGet
|
|
957
920
|
do
|
|
958
|
-
local
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
return value
|
|
962
|
-
end
|
|
963
|
-
local metatable = getmetatable(self)
|
|
921
|
+
local getmetatable = _G.getmetatable
|
|
922
|
+
local ____rawget = _G.rawget
|
|
923
|
+
function __TS__DescriptorGet(self, metatable, key)
|
|
964
924
|
while metatable do
|
|
965
|
-
local rawResult =
|
|
925
|
+
local rawResult = ____rawget(metatable, key)
|
|
966
926
|
if rawResult ~= nil then
|
|
967
927
|
return rawResult
|
|
968
928
|
end
|
|
969
|
-
local descriptors =
|
|
929
|
+
local descriptors = ____rawget(metatable, "_descriptors")
|
|
970
930
|
if descriptors then
|
|
971
931
|
local descriptor = descriptors[key]
|
|
972
932
|
if descriptor ~= nil then
|
|
@@ -979,10 +939,16 @@ do
|
|
|
979
939
|
metatable = getmetatable(metatable)
|
|
980
940
|
end
|
|
981
941
|
end
|
|
982
|
-
|
|
983
|
-
|
|
942
|
+
end
|
|
943
|
+
|
|
944
|
+
local __TS__DescriptorSet
|
|
945
|
+
do
|
|
946
|
+
local getmetatable = _G.getmetatable
|
|
947
|
+
local ____rawget = _G.rawget
|
|
948
|
+
local rawset = _G.rawset
|
|
949
|
+
function __TS__DescriptorSet(self, metatable, key, value)
|
|
984
950
|
while metatable do
|
|
985
|
-
local descriptors =
|
|
951
|
+
local descriptors = ____rawget(metatable, "_descriptors")
|
|
986
952
|
if descriptors then
|
|
987
953
|
local descriptor = descriptors[key]
|
|
988
954
|
if descriptor ~= nil then
|
|
@@ -1004,6 +970,26 @@ do
|
|
|
1004
970
|
end
|
|
1005
971
|
rawset(self, key, value)
|
|
1006
972
|
end
|
|
973
|
+
end
|
|
974
|
+
|
|
975
|
+
local __TS__SetDescriptor
|
|
976
|
+
do
|
|
977
|
+
local getmetatable = _G.getmetatable
|
|
978
|
+
local function descriptorIndex(self, key)
|
|
979
|
+
return __TS__DescriptorGet(
|
|
980
|
+
self,
|
|
981
|
+
getmetatable(self),
|
|
982
|
+
key
|
|
983
|
+
)
|
|
984
|
+
end
|
|
985
|
+
local function descriptorNewIndex(self, key, value)
|
|
986
|
+
return __TS__DescriptorSet(
|
|
987
|
+
self,
|
|
988
|
+
getmetatable(self),
|
|
989
|
+
key,
|
|
990
|
+
value
|
|
991
|
+
)
|
|
992
|
+
end
|
|
1007
993
|
function __TS__SetDescriptor(target, key, desc, isPrototype)
|
|
1008
994
|
if isPrototype == nil then
|
|
1009
995
|
isPrototype = false
|
|
@@ -1232,6 +1218,18 @@ local function __TS__DelegatedYield(iterable)
|
|
|
1232
1218
|
end
|
|
1233
1219
|
end
|
|
1234
1220
|
|
|
1221
|
+
local function __TS__FunctionBind(fn, ...)
|
|
1222
|
+
local boundArgs = {...}
|
|
1223
|
+
return function(____, ...)
|
|
1224
|
+
local args = {...}
|
|
1225
|
+
__TS__ArrayUnshift(
|
|
1226
|
+
args,
|
|
1227
|
+
__TS__Unpack(boundArgs)
|
|
1228
|
+
)
|
|
1229
|
+
return fn(__TS__Unpack(args))
|
|
1230
|
+
end
|
|
1231
|
+
end
|
|
1232
|
+
|
|
1235
1233
|
local __TS__Generator
|
|
1236
1234
|
do
|
|
1237
1235
|
local function generatorIterator(self)
|
|
@@ -1420,6 +1418,22 @@ do
|
|
|
1420
1418
|
Map[Symbol.species] = Map
|
|
1421
1419
|
end
|
|
1422
1420
|
|
|
1421
|
+
local function __TS__MapGroupBy(items, keySelector)
|
|
1422
|
+
local result = __TS__New(Map)
|
|
1423
|
+
local i = 0
|
|
1424
|
+
for ____, item in __TS__Iterator(items) do
|
|
1425
|
+
local key = keySelector(nil, item, i)
|
|
1426
|
+
if result:has(key) then
|
|
1427
|
+
local ____temp_0 = result:get(key)
|
|
1428
|
+
____temp_0[#____temp_0 + 1] = item
|
|
1429
|
+
else
|
|
1430
|
+
result:set(key, {item})
|
|
1431
|
+
end
|
|
1432
|
+
i = i + 1
|
|
1433
|
+
end
|
|
1434
|
+
return result
|
|
1435
|
+
end
|
|
1436
|
+
|
|
1423
1437
|
local __TS__Match = string.match
|
|
1424
1438
|
|
|
1425
1439
|
local __TS__MathAtan2 = math.atan2 or math.atan
|
|
@@ -1674,6 +1688,22 @@ local function __TS__ObjectFromEntries(entries)
|
|
|
1674
1688
|
return obj
|
|
1675
1689
|
end
|
|
1676
1690
|
|
|
1691
|
+
local function __TS__ObjectGroupBy(items, keySelector)
|
|
1692
|
+
local result = {}
|
|
1693
|
+
local i = 0
|
|
1694
|
+
for ____, item in __TS__Iterator(items) do
|
|
1695
|
+
local key = keySelector(nil, item, i)
|
|
1696
|
+
if result[key] ~= nil then
|
|
1697
|
+
local ____result_key_0 = result[key]
|
|
1698
|
+
____result_key_0[#____result_key_0 + 1] = item
|
|
1699
|
+
else
|
|
1700
|
+
result[key] = {item}
|
|
1701
|
+
end
|
|
1702
|
+
i = i + 1
|
|
1703
|
+
end
|
|
1704
|
+
return result
|
|
1705
|
+
end
|
|
1706
|
+
|
|
1677
1707
|
local function __TS__ObjectKeys(obj)
|
|
1678
1708
|
local result = {}
|
|
1679
1709
|
local len = 0
|
|
@@ -2551,6 +2581,8 @@ return {
|
|
|
2551
2581
|
__TS__DecorateParam = __TS__DecorateParam,
|
|
2552
2582
|
__TS__Delete = __TS__Delete,
|
|
2553
2583
|
__TS__DelegatedYield = __TS__DelegatedYield,
|
|
2584
|
+
__TS__DescriptorGet = __TS__DescriptorGet,
|
|
2585
|
+
__TS__DescriptorSet = __TS__DescriptorSet,
|
|
2554
2586
|
Error = Error,
|
|
2555
2587
|
RangeError = RangeError,
|
|
2556
2588
|
ReferenceError = ReferenceError,
|
|
@@ -2564,6 +2596,7 @@ return {
|
|
|
2564
2596
|
__TS__Iterator = __TS__Iterator,
|
|
2565
2597
|
__TS__LuaIteratorSpread = __TS__LuaIteratorSpread,
|
|
2566
2598
|
Map = Map,
|
|
2599
|
+
__TS__MapGroupBy = __TS__MapGroupBy,
|
|
2567
2600
|
__TS__Match = __TS__Match,
|
|
2568
2601
|
__TS__MathAtan2 = __TS__MathAtan2,
|
|
2569
2602
|
__TS__MathModf = __TS__MathModf,
|
|
@@ -2583,6 +2616,7 @@ return {
|
|
|
2583
2616
|
__TS__ObjectFromEntries = __TS__ObjectFromEntries,
|
|
2584
2617
|
__TS__ObjectGetOwnPropertyDescriptor = __TS__ObjectGetOwnPropertyDescriptor,
|
|
2585
2618
|
__TS__ObjectGetOwnPropertyDescriptors = __TS__ObjectGetOwnPropertyDescriptors,
|
|
2619
|
+
__TS__ObjectGroupBy = __TS__ObjectGroupBy,
|
|
2586
2620
|
__TS__ObjectKeys = __TS__ObjectKeys,
|
|
2587
2621
|
__TS__ObjectRest = __TS__ObjectRest,
|
|
2588
2622
|
__TS__ObjectValues = __TS__ObjectValues,
|
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ObjectValues.d.ts","sourceRoot":"","sources":["../../src/types/ObjectValues.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
export type TupleToIntersection<T extends unknown[]> = T extends [
|
|
2
|
-
infer F,
|
|
3
|
-
...infer R
|
|
4
|
-
] ? F & TupleToIntersection<R> : unknown;
|
|
1
|
+
export type TupleToIntersection<T extends readonly unknown[]> = T extends readonly [infer F, ...infer R] ? F & TupleToIntersection<R> : unknown;
|
|
5
2
|
//# sourceMappingURL=TupleToIntersection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TupleToIntersection.d.ts","sourceRoot":"","sources":["../../src/types/TupleToIntersection.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"TupleToIntersection.d.ts","sourceRoot":"","sources":["../../src/types/TupleToIntersection.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,IAC1D,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,GACpC,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,GAC1B,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "87.
|
|
3
|
+
"version": "87.4.0",
|
|
4
4
|
"description": "Helper functions and features for IsaacScript mods.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -37,6 +37,6 @@
|
|
|
37
37
|
"lint": "tsx --tsconfig ./scripts/tsconfig.json ./scripts/lint.mts"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"isaac-typescript-definitions": "^
|
|
40
|
+
"isaac-typescript-definitions": "^42.0.2"
|
|
41
41
|
}
|
|
42
42
|
}
|
package/src/functions/math.ts
CHANGED
|
@@ -21,7 +21,7 @@ export function getAngleDifference(angle1: float, angle2: float): float {
|
|
|
21
21
|
* Useful for equally distributing things in a circle pattern.
|
|
22
22
|
*
|
|
23
23
|
* @param centerPos A position that represents the center of the center to get the points from.
|
|
24
|
-
* @param radius The radius of the circle.
|
|
24
|
+
* @param radius The length of the radius of the circle.
|
|
25
25
|
* @param numPoints The number of points on the circumference of the circle to get.
|
|
26
26
|
* @param xMultiplier An optional multiplier to get the points around an oval. Default is 1.
|
|
27
27
|
* @param yMultiplier An optional multiplier to get the points around an oval. Default is 1.
|
package/src/functions/stats.ts
CHANGED
package/src/functions/string.ts
CHANGED
|
@@ -140,7 +140,7 @@ export function getPartialMatch(
|
|
|
140
140
|
* Helper function to parse a Semantic Versioning string into its individual constituents. Returns
|
|
141
141
|
* undefined if the submitted string was not a proper Semantic Version string.
|
|
142
142
|
*
|
|
143
|
-
* https://semver.org/
|
|
143
|
+
* @see https://semver.org/
|
|
144
144
|
*/
|
|
145
145
|
export function parseSemanticVersion(versionString: string):
|
|
146
146
|
| {
|