From 4adcf079e2b23c16f9b4104e550b83304358e165 Mon Sep 17 00:00:00 2001 From: Cattle_Horse Date: Thu, 5 Jun 2025 20:37:09 +0800 Subject: [PATCH] fix(std/iter): align example descriptions with closure logic for find and find-index (#15895) - Updated the second @example for `find` to "Try to find an even element" to match the closure logic. - Updated the second @example for `find-index` to "Try to find the index of an even element" for consistency. --- crates/nu-std/std/iter/mod.nu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/nu-std/std/iter/mod.nu b/crates/nu-std/std/iter/mod.nu index d4db0a3a5f..04859cd0f0 100644 --- a/crates/nu-std/std/iter/mod.nu +++ b/crates/nu-std/std/iter/mod.nu @@ -14,7 +14,7 @@ @example "Find an element starting with 'a'" { ["shell", "abc", "around", "nushell", "std"] | iter find {|e| $e starts-with "a" } } --result "abc" -@example "Try to find an element starting with 'a'" { ["shell", "abc", "around", "nushell", "std"] | iter find {|e| $e mod 2 == 0} } --result null +@example "Try to find an even element" { ["shell", "abc", "around", "nushell", "std"] | iter find {|e| $e mod 2 == 0} } --result null export def find [ fn: closure # the closure used to perform the search ] { @@ -29,7 +29,7 @@ export def find [ @example "Find the index of an element starting with 's'" { ["iter", "abc", "shell", "around", "nushell", "std"] | iter find-index {|x| $x starts-with 's'} } --result 2 -@example "Try to find the index of an element starting with 's'" { +@example "Try to find the index of an even element" { [3 5 13 91] | iter find-index {|x| $x mod 2 == 0} } --result -1 export def find-index [