first
优质
小牛编辑
121浏览
2023-12-01
An optimized version of Sequence#first that returns another StringLikeSequence (or just the first character, if count
is undefined).
Examples
Lazy('foo').first() // => 'f' Lazy('fo').first(2) // sequence: 'fo' Lazy('foo').first(10) // sequence: 'foo' Lazy('foo').toUpperCase().first() // => 'F' Lazy('foo').toUpperCase().first(2) // sequence: 'FO'