(self: List<A>)
| 951 | * @category unsafe |
| 952 | */ |
| 953 | export const unsafeLast = <A>(self: List<A>): A => { |
| 954 | if (isNil(self)) { |
| 955 | throw new Error(getExpectedListToBeNonEmptyErrorMessage) |
| 956 | } |
| 957 | let these = self |
| 958 | let scout = self.tail |
| 959 | while (!isNil(scout)) { |
| 960 | these = scout |
| 961 | scout = scout.tail |
| 962 | } |
| 963 | return these.head |
| 964 | } |
| 965 | |
| 966 | /** |
| 967 | * Unsafely returns the tail of the specified `List`. |