Skip to content

Commit c6d5349

Browse files
committed
Added for_in_range function
1 parent b7953b7 commit c6d5349

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,18 @@ function find_key_and_update(arr, parent_key, parent_value, target_key, target_v
485485
return arr;
486486
}
487487

488+
/**
489+
* For in range loop like python
490+
*
491+
* @param integer num
492+
* @param function callback
493+
*/
494+
function for_in_range(num, callback) {
495+
for (let i = 0; i < num; i++) {
496+
callback(i)
497+
}
498+
}
499+
488500
export {
489501
is_array,
490502
is_num_array,
@@ -512,4 +524,5 @@ export {
512524
get_rms_value,
513525
find_key_and_update,
514526
find_and_update,
527+
for_in_range,
515528
};

0 commit comments

Comments
 (0)