mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-21 14:04:53 +02:00
find_index: test support elem
This commit is contained in:
@@ -19,5 +19,7 @@ new:
|
|||||||
- lemniscate_curve?
|
- lemniscate_curve?
|
||||||
- perlin_sphere?
|
- perlin_sphere?
|
||||||
|
|
||||||
|
- find_index: test support elem
|
||||||
|
|
||||||
deprecated:
|
deprecated:
|
||||||
rails2sections: use m_transpose
|
rails2sections: use m_transpose
|
@@ -9,9 +9,15 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
function find_index(lt, test) =
|
function find_index(lt, test) =
|
||||||
|
is_function(test) ? (
|
||||||
let(
|
let(
|
||||||
leng = len(lt),
|
leng = len(lt),
|
||||||
indices = [for(i = 0; i < leng && !test(lt[i]); i = i + 1) undef],
|
indices = [for(i = 0; i < leng && !test(lt[i]); i = i + 1) undef],
|
||||||
leng_indices = len(indices)
|
leng_indices = len(indices)
|
||||||
)
|
)
|
||||||
leng_indices == leng ? -1 : leng_indices;
|
leng_indices == leng ? -1 : leng_indices
|
||||||
|
) : (
|
||||||
|
let(found = search([key], bucket)[0])
|
||||||
|
found == [] ? - 1 : found
|
||||||
|
);
|
||||||
|
|
Reference in New Issue
Block a user