react-native-twopane-navigation
Version:
React Native package for dual screen devices navigation support (Surface Duo)
20 lines (16 loc) • 355 B
text/typescript
declare global {
interface Array<T> {
/**
* Returns the last element from an array.
*/
peek(): T;
}
}
Array.prototype.peek = function () {
if (this.length > 0) {
return this[this.length - 1];
}
// empty array...
return undefined; // or another default value...
};
export {}