isaacscript-common 67.1.1 → 67.3.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/index.rollup.d.ts +7 -2
- package/dist/isaacscript-common.lua +14 -7
- package/dist/src/functions/collectibles.d.ts +3 -1
- package/dist/src/functions/collectibles.d.ts.map +1 -1
- package/dist/src/functions/collectibles.lua +6 -1
- package/dist/src/functions/math.d.ts +3 -1
- package/dist/src/functions/math.d.ts.map +1 -1
- package/dist/src/functions/math.lua +11 -6
- package/package.json +1 -1
- package/src/functions/collectibles.ts +9 -1
- package/src/functions/math.ts +12 -6
package/dist/index.rollup.d.ts
CHANGED
|
@@ -8574,7 +8574,7 @@ export declare function isActionTriggered(controllerIndex: ControllerIndex, ...b
|
|
|
8574
8574
|
*/
|
|
8575
8575
|
export declare function isActionTriggeredOnAnyInput(...buttonActions: ButtonAction[]): boolean;
|
|
8576
8576
|
|
|
8577
|
-
/** Returns true if the item type in the item config is equal to `ItemType.
|
|
8577
|
+
/** Returns true if the item type in the item config is equal to `ItemType.ACTIVE`. */
|
|
8578
8578
|
export declare function isActiveCollectible(collectibleType: CollectibleType): boolean;
|
|
8579
8579
|
|
|
8580
8580
|
/**
|
|
@@ -9175,6 +9175,9 @@ export declare function isEven(num: int): boolean;
|
|
|
9175
9175
|
/** Helper function to detect if a variable is of type `EntityFamiliar`. */
|
|
9176
9176
|
export declare function isFamiliar(variable: unknown): variable is EntityFamiliar;
|
|
9177
9177
|
|
|
9178
|
+
/** Returns true if the item type in the item config is equal to `ItemType.FAMILIAR`. */
|
|
9179
|
+
export declare function isFamiliarCollectible(collectibleType: CollectibleType): boolean;
|
|
9180
|
+
|
|
9178
9181
|
/**
|
|
9179
9182
|
* Helper function to detect if the given familiar is "stolen" by The Siren boss.
|
|
9180
9183
|
*
|
|
@@ -17960,8 +17963,10 @@ export declare function spawnWithSeed(entityType: EntityType, variant: int, subT
|
|
|
17960
17963
|
*
|
|
17961
17964
|
* @param num The number to split into chunks. This must be a positive integer.
|
|
17962
17965
|
* @param size The size of each chunk. This must be a positive integer.
|
|
17966
|
+
* @param startAtZero Whether to start at 0. Defaults to false. If true, the chunks will start at 0
|
|
17967
|
+
* instead of 1.
|
|
17963
17968
|
*/
|
|
17964
|
-
export declare function splitNumber(num: int, size: int): Array<[min: int, max: int]>;
|
|
17969
|
+
export declare function splitNumber(num: int, size: int, startAtZero?: boolean): Array<[min: int, max: int]>;
|
|
17965
17970
|
|
|
17966
17971
|
/**
|
|
17967
17972
|
* Helper function to check if two sprite layers have the same sprite sheet by using the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 67.
|
|
3
|
+
isaacscript-common 67.3.0
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -20311,7 +20311,10 @@ function ____exports.sign(self, n)
|
|
|
20311
20311
|
end
|
|
20312
20312
|
return 0
|
|
20313
20313
|
end
|
|
20314
|
-
function ____exports.splitNumber(self, num, size)
|
|
20314
|
+
function ____exports.splitNumber(self, num, size, startAtZero)
|
|
20315
|
+
if startAtZero == nil then
|
|
20316
|
+
startAtZero = false
|
|
20317
|
+
end
|
|
20315
20318
|
if num <= 0 then
|
|
20316
20319
|
error("The number to split needs to be a positive number and is instead: " .. tostring(num))
|
|
20317
20320
|
end
|
|
@@ -20319,11 +20322,11 @@ function ____exports.splitNumber(self, num, size)
|
|
|
20319
20322
|
error("The size to split needs to be a positive number and is instead: " .. tostring(num))
|
|
20320
20323
|
end
|
|
20321
20324
|
local chunks = {}
|
|
20322
|
-
local
|
|
20323
|
-
while
|
|
20324
|
-
local
|
|
20325
|
-
chunks[#chunks + 1] = {
|
|
20326
|
-
|
|
20325
|
+
local start = startAtZero and 0 or 1
|
|
20326
|
+
while start <= num do
|
|
20327
|
+
local ____end = math.min(start + size - 1, num)
|
|
20328
|
+
chunks[#chunks + 1] = {start, ____end}
|
|
20329
|
+
start = start + size
|
|
20327
20330
|
end
|
|
20328
20331
|
return chunks
|
|
20329
20332
|
end
|
|
@@ -24460,6 +24463,10 @@ function ____exports.isBlindCollectible(self, collectible)
|
|
|
24460
24463
|
questionMarkSprite:SetFrame(animation, frame)
|
|
24461
24464
|
return ____exports.collectibleSpriteEquals(nil, sprite, questionMarkSprite)
|
|
24462
24465
|
end
|
|
24466
|
+
function ____exports.isFamiliarCollectible(self, collectibleType)
|
|
24467
|
+
local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
|
|
24468
|
+
return itemType == ItemType.FAMILIAR
|
|
24469
|
+
end
|
|
24463
24470
|
function ____exports.isGlitchedCollectible(self, collectible)
|
|
24464
24471
|
return collectible.Variant == PickupVariant.COLLECTIBLE and collectible.SubType > GLITCHED_ITEM_THRESHOLD
|
|
24465
24472
|
end
|
|
@@ -92,7 +92,7 @@ export declare function getCollectibleTags(collectibleOrCollectibleType: EntityP
|
|
|
92
92
|
* types, use the `getCollectibleTypesOfQuality` helper function instead.
|
|
93
93
|
*/
|
|
94
94
|
export declare function getVanillaCollectibleTypesOfQuality(quality: Quality): ReadonlySet<CollectibleType>;
|
|
95
|
-
/** Returns true if the item type in the item config is equal to `ItemType.
|
|
95
|
+
/** Returns true if the item type in the item config is equal to `ItemType.ACTIVE`. */
|
|
96
96
|
export declare function isActiveCollectible(collectibleType: CollectibleType): boolean;
|
|
97
97
|
/**
|
|
98
98
|
* Returns true if the collectible has a red question mark sprite.
|
|
@@ -101,6 +101,8 @@ export declare function isActiveCollectible(collectibleType: CollectibleType): b
|
|
|
101
101
|
* `RenderMode.WATER_REFLECT`. If this is detected, this function will throw a run-time error.
|
|
102
102
|
*/
|
|
103
103
|
export declare function isBlindCollectible(collectible: EntityPickup): boolean;
|
|
104
|
+
/** Returns true if the item type in the item config is equal to `ItemType.FAMILIAR`. */
|
|
105
|
+
export declare function isFamiliarCollectible(collectibleType: CollectibleType): boolean;
|
|
104
106
|
/**
|
|
105
107
|
* Returns whether the given collectible is a "glitched" item. All items are replaced by glitched
|
|
106
108
|
* items once a player has TMTRAINER. However, glitched items can also "naturally" appear in secret
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collectibles.d.ts","sourceRoot":"","sources":["../../../src/functions/collectibles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,uBAAuB,EACvB,aAAa,EACd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,eAAe,EAEf,oBAAoB,EAEpB,QAAQ,EACR,WAAW,EAGZ,MAAM,8BAA8B,CAAC;AAgEtC,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,CAStE;AAED,iGAAiG;AACjG,wBAAgB,uBAAuB,CACrC,4BAA4B,EAAE,YAAY,GAAG,eAAe,EAC5D,SAAS,EAAE,SAAS,GACnB,OAAO,CAYT;AAED,6FAA6F;AAC7F,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAsBT;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,4BAA4B,EAAE,YAAY,GAAG,eAAe,GAC3D,oBAAoB,CAYtB;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,4BAA4B,EAAE,YAAY,GAAG,eAAe,GAC3D,MAAM,CAqBR;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,4BAA4B,EAAE,YAAY,GAAG,eAAe,GAC3D,GAAG,CAgBL;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,4BAA4B,EAAE,YAAY,GAAG,eAAe,EAC5D,MAAM,EAAE,YAAY,GACnB,WAAW,CA6Bb;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,4BAA4B,EAAE,YAAY,GAAG,eAAe,GAAG,CAAC,CAAC,GAChE,MAAM,CAgBR;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,4BAA4B,EAAE,YAAY,GAAG,eAAe,GAC3D,GAAG,CAYL;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,4BAA4B,EAAE,YAAY,GAAG,eAAe,GAC3D,QAAQ,CAYV;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,4BAA4B,EAAE,YAAY,GAAG,eAAe,GAC3D,GAAG,CAYL;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,4BAA4B,EAAE,YAAY,GAAG,eAAe,GAC3D,MAAM,CAqBR;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,YAAY,GACxB,uBAAuB,CAUzB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,4BAA4B,EAAE,YAAY,GAAG,eAAe,GAC3D,OAAO,CAYT;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,4BAA4B,EAAE,YAAY,GAAG,eAAe,GAC3D,QAAQ,CAAC,aAAa,CAAC,CAQzB;AAED;;;;;GAKG;AACH,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,OAAO,GACf,WAAW,CAAC,eAAe,CAAC,CAS9B;AAED,
|
|
1
|
+
{"version":3,"file":"collectibles.d.ts","sourceRoot":"","sources":["../../../src/functions/collectibles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,uBAAuB,EACvB,aAAa,EACd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAEL,eAAe,EAEf,oBAAoB,EAEpB,QAAQ,EACR,WAAW,EAGZ,MAAM,8BAA8B,CAAC;AAgEtC,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,CAStE;AAED,iGAAiG;AACjG,wBAAgB,uBAAuB,CACrC,4BAA4B,EAAE,YAAY,GAAG,eAAe,EAC5D,SAAS,EAAE,SAAS,GACnB,OAAO,CAYT;AAED,6FAA6F;AAC7F,wBAAgB,uBAAuB,CACrC,OAAO,EA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EAAE,YAAY,GAAG,IAAI,CASnE;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,CAUnE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,YAAY,GAAG,IAAI,CAuBtE;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,WAAW,EAAE,YAAY,EACzB,uBAAuB,EAAE,uBAAuB,GAC/C,IAAI,CAWN;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,YAAY,EACzB,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,IAAI,CAqBN;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,WAAW,EAAE,YAAY,EACzB,kBAAkB,EAAE,eAAe,GAClC,IAAI,CA2BN;AAED;;;GAGG;AACH,wBAAgB,qCAAqC,IAAI,IAAI,CAK5D"}
|
|
@@ -352,7 +352,7 @@ function ____exports.getVanillaCollectibleTypesOfQuality(self, quality)
|
|
|
352
352
|
)
|
|
353
353
|
return collectibleTypes
|
|
354
354
|
end
|
|
355
|
-
--- Returns true if the item type in the item config is equal to `ItemType.
|
|
355
|
+
--- Returns true if the item type in the item config is equal to `ItemType.ACTIVE`.
|
|
356
356
|
function ____exports.isActiveCollectible(self, collectibleType)
|
|
357
357
|
local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
|
|
358
358
|
return itemType == ItemType.ACTIVE
|
|
@@ -377,6 +377,11 @@ function ____exports.isBlindCollectible(self, collectible)
|
|
|
377
377
|
questionMarkSprite:SetFrame(animation, frame)
|
|
378
378
|
return ____exports.collectibleSpriteEquals(nil, sprite, questionMarkSprite)
|
|
379
379
|
end
|
|
380
|
+
--- Returns true if the item type in the item config is equal to `ItemType.FAMILIAR`.
|
|
381
|
+
function ____exports.isFamiliarCollectible(self, collectibleType)
|
|
382
|
+
local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
|
|
383
|
+
return itemType == ItemType.FAMILIAR
|
|
384
|
+
end
|
|
380
385
|
--- Returns whether the given collectible is a "glitched" item. All items are replaced by glitched
|
|
381
386
|
-- items once a player has TMTRAINER. However, glitched items can also "naturally" appear in secret
|
|
382
387
|
-- rooms and I AM ERROR rooms if the "Corrupted Data" achievement is unlocked.
|
|
@@ -59,7 +59,9 @@ export declare function sign(n: number): int;
|
|
|
59
59
|
*
|
|
60
60
|
* @param num The number to split into chunks. This must be a positive integer.
|
|
61
61
|
* @param size The size of each chunk. This must be a positive integer.
|
|
62
|
+
* @param startAtZero Whether to start at 0. Defaults to false. If true, the chunks will start at 0
|
|
63
|
+
* instead of 1.
|
|
62
64
|
*/
|
|
63
|
-
export declare function splitNumber(num: int, size: int): Array<[min: int, max: int]>;
|
|
65
|
+
export declare function splitNumber(num: int, size: int, startAtZero?: boolean): Array<[min: int, max: int]>;
|
|
64
66
|
export declare function tanh(x: number): number;
|
|
65
67
|
//# sourceMappingURL=math.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"math.d.ts","sourceRoot":"","sources":["../../../src/functions/math.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAGzD;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,GAAG,CAEvD;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,KAAK,CAGtE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,KAAK,EACb,SAAS,EAAE,GAAG,EACd,WAAW,SAAI,EACf,WAAW,SAAI,EACf,gBAAgB,YAAe,GAC9B,MAAM,EAAE,CAaV;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,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,WAAW,SAAI,EACf,gBAAgB,YAAe,GAC9B,MAAM,EAAE,CAaV;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,MAAM,GAClB,OAAO,CAOT;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CAC3C,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,KAAK,EACnB,gBAAgB,EAAE,MAAM,EACxB,oBAAoB,EAAE,MAAM,GAC3B,OAAO,CAgBT;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAGxC;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAGvC;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,GAAG,MAAM,CAE7D;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,KAAK,GACb,MAAM,CAER;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,gBAAgB,SAAI,GAAG,KAAK,CAG7D;AAED,wEAAwE;AACxE,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAUnC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,GAAG,EACT,WAAW,UAAQ,GAClB,KAAK,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAuB7B;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEtC"}
|
|
@@ -125,7 +125,12 @@ end
|
|
|
125
125
|
--
|
|
126
126
|
-- @param num The number to split into chunks. This must be a positive integer.
|
|
127
127
|
-- @param size The size of each chunk. This must be a positive integer.
|
|
128
|
-
|
|
128
|
+
-- @param startAtZero Whether to start at 0. Defaults to false. If true, the chunks will start at 0
|
|
129
|
+
-- instead of 1.
|
|
130
|
+
function ____exports.splitNumber(self, num, size, startAtZero)
|
|
131
|
+
if startAtZero == nil then
|
|
132
|
+
startAtZero = false
|
|
133
|
+
end
|
|
129
134
|
if num <= 0 then
|
|
130
135
|
error("The number to split needs to be a positive number and is instead: " .. tostring(num))
|
|
131
136
|
end
|
|
@@ -133,11 +138,11 @@ function ____exports.splitNumber(self, num, size)
|
|
|
133
138
|
error("The size to split needs to be a positive number and is instead: " .. tostring(num))
|
|
134
139
|
end
|
|
135
140
|
local chunks = {}
|
|
136
|
-
local
|
|
137
|
-
while
|
|
138
|
-
local
|
|
139
|
-
chunks[#chunks + 1] = {
|
|
140
|
-
|
|
141
|
+
local start = startAtZero and 0 or 1
|
|
142
|
+
while start <= num do
|
|
143
|
+
local ____end = math.min(start + size - 1, num)
|
|
144
|
+
chunks[#chunks + 1] = {start, ____end}
|
|
145
|
+
start = start + size
|
|
141
146
|
end
|
|
142
147
|
return chunks
|
|
143
148
|
end
|
package/package.json
CHANGED
|
@@ -451,7 +451,7 @@ export function getVanillaCollectibleTypesOfQuality(
|
|
|
451
451
|
return collectibleTypes;
|
|
452
452
|
}
|
|
453
453
|
|
|
454
|
-
/** Returns true if the item type in the item config is equal to `ItemType.
|
|
454
|
+
/** Returns true if the item type in the item config is equal to `ItemType.ACTIVE`. */
|
|
455
455
|
export function isActiveCollectible(collectibleType: CollectibleType): boolean {
|
|
456
456
|
const itemType = getCollectibleItemType(collectibleType);
|
|
457
457
|
return itemType === ItemType.ACTIVE;
|
|
@@ -487,6 +487,14 @@ export function isBlindCollectible(collectible: EntityPickup): boolean {
|
|
|
487
487
|
return collectibleSpriteEquals(sprite, questionMarkSprite);
|
|
488
488
|
}
|
|
489
489
|
|
|
490
|
+
/** Returns true if the item type in the item config is equal to `ItemType.FAMILIAR`. */
|
|
491
|
+
export function isFamiliarCollectible(
|
|
492
|
+
collectibleType: CollectibleType,
|
|
493
|
+
): boolean {
|
|
494
|
+
const itemType = getCollectibleItemType(collectibleType);
|
|
495
|
+
return itemType === ItemType.FAMILIAR;
|
|
496
|
+
}
|
|
497
|
+
|
|
490
498
|
/**
|
|
491
499
|
* Returns whether the given collectible is a "glitched" item. All items are replaced by glitched
|
|
492
500
|
* items once a player has TMTRAINER. However, glitched items can also "naturally" appear in secret
|
package/src/functions/math.ts
CHANGED
|
@@ -156,8 +156,14 @@ export function sign(n: number): int {
|
|
|
156
156
|
*
|
|
157
157
|
* @param num The number to split into chunks. This must be a positive integer.
|
|
158
158
|
* @param size The size of each chunk. This must be a positive integer.
|
|
159
|
+
* @param startAtZero Whether to start at 0. Defaults to false. If true, the chunks will start at 0
|
|
160
|
+
* instead of 1.
|
|
159
161
|
*/
|
|
160
|
-
export function splitNumber(
|
|
162
|
+
export function splitNumber(
|
|
163
|
+
num: int,
|
|
164
|
+
size: int,
|
|
165
|
+
startAtZero = false,
|
|
166
|
+
): Array<[min: int, max: int]> {
|
|
161
167
|
if (num <= 0) {
|
|
162
168
|
error(
|
|
163
169
|
`The number to split needs to be a positive number and is instead: ${num}`,
|
|
@@ -171,12 +177,12 @@ export function splitNumber(num: int, size: int): Array<[min: int, max: int]> {
|
|
|
171
177
|
}
|
|
172
178
|
|
|
173
179
|
const chunks: Array<[number, number]> = [];
|
|
174
|
-
let
|
|
180
|
+
let start = startAtZero ? 0 : 1;
|
|
175
181
|
|
|
176
|
-
while (
|
|
177
|
-
const
|
|
178
|
-
chunks.push([
|
|
179
|
-
|
|
182
|
+
while (start <= num) {
|
|
183
|
+
const end = Math.min(start + size - 1, num);
|
|
184
|
+
chunks.push([start, end]);
|
|
185
|
+
start += size;
|
|
180
186
|
}
|
|
181
187
|
|
|
182
188
|
return chunks;
|