fix: make last(empty) yield no output values (#3179)

This commit is contained in:
itchyny authored and GitHub committed 2024-11-13 20:35:50 +09:00
1 parent 3c5707f7fb
commit a7b22539a4
6 files changed
+46 -4

No files matched your search

+4
View File
@@ -362,6 +362,10 @@ null
10
[0,9]
[first(range(.)), last(range(.))]
0
[]
[nth(0,5,9,10,15; range(.)), try nth(-1; range(.)) catch .]
10
[0,5,9,"nth doesn't support negative indices"]
+5 -1
View File
@@ -881,10 +881,14 @@ false
[0,1,2,3,4,5,6,7,8,9]
[3,4,5,6,7,8,9]
[first(range(.)), last(range(.)), nth(./2; range(.))]
[first(range(.)), last(range(.)), nth(5; range(.))]
10
[0,9,5]
[first(empty), last(empty), nth(5; empty)]
null
[]
[range(.)]|[first, last, nth(5)]
10
[0,9,5]