Skip to content

Commit c00d6f5

Browse files
committed
chore: small perf op
1 parent eb7b661 commit c00d6f5

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

packages/payments/index.ios.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ class SKProductRequestDelegateImpl extends NSObject implements SKProductsRequest
182182
}
183183

184184
const result: Array<Item> = [];
185-
for (let i = 0; i < products.count; i++) {
185+
const count = products.count;
186+
for (let i = 0; i < count; i++) {
186187
result.push(new Item(products.objectAtIndex(i)));
187188
}
188189

@@ -269,8 +270,9 @@ function _transactionHandler(queue: SKPaymentQueue, transactions: NSArray<SKPaym
269270
result: PaymentEvent.Result.PENDING,
270271
payload: queue.transactions ? queue.transactions.count : 0,
271272
});
272-
if (transactions && transactions.count) {
273-
for (let i = 0; i < transactions.count; i++) {
273+
const count = transactions?.count ?? 0;
274+
if (count) {
275+
for (let i = 0; i < count; i++) {
274276
const transaction: SKPaymentTransaction = transactions.objectAtIndex(i);
275277

276278
switch (transaction.transactionState) {

0 commit comments

Comments
 (0)