This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from "lodash"; | |
function paginate( | |
items, | |
page=1, | |
pageSize = 100 | |
){ | |
const offset = (page - 1) * pageSize; | |
const pagedItems = _.drop(items, offset).slice(0, pageSize); | |
return { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jwtDecode from "jwt-decode"; | |
function dateFromUnix(unix){ | |
return new Date(unix * 1000) | |
} | |
function isTokenExpired(token: string,unixField="exp"){ | |
if (token) { | |
const decoded = jwtDecode(token); | |
const exp = decoded[unixField] | |
return dateFromUnix(exp) < new Date() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { ReactNode } from "react"; | |
import { View as ReactView, ViewStyle } from "react-native"; | |
export type CustomProps = Partial<{ | |
mt: number | "auto"; | |
mb: number | "auto"; | |
my: number | "auto"; | |
mx: number | "auto"; | |
ml: number | "auto"; | |
mr: number | "auto"; |