Update expo application
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
export type ParsedEnvSecret = {
|
||||
name: string;
|
||||
value: string;
|
||||
};
|
||||
|
||||
export const parseEnvText = (text: string): ParsedEnvSecret[] => {
|
||||
const secrets: ParsedEnvSecret[] = [];
|
||||
for (const rawLine of text.split(/\r?\n/)) {
|
||||
const line = rawLine.trim();
|
||||
if (!line || line.startsWith('#')) continue;
|
||||
const normalized = line.startsWith('export ') ? line.slice(7).trim() : line;
|
||||
const separator = normalized.indexOf('=');
|
||||
if (separator <= 0) continue;
|
||||
const name = normalized.slice(0, separator).trim();
|
||||
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(name)) continue;
|
||||
let value = normalized.slice(separator + 1).trim();
|
||||
if (
|
||||
(value.startsWith('"') && value.endsWith('"')) ||
|
||||
(value.startsWith("'") && value.endsWith("'"))
|
||||
) {
|
||||
value = value.slice(1, -1);
|
||||
}
|
||||
secrets.push({ name: name.toUpperCase(), value });
|
||||
}
|
||||
return secrets;
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
export const formatDate = (value?: number) =>
|
||||
value
|
||||
? new Intl.DateTimeFormat('en', { dateStyle: 'medium' }).format(value)
|
||||
: 'Never';
|
||||
|
||||
export const formatDateTime = (value?: number) =>
|
||||
value
|
||||
? new Intl.DateTimeFormat('en', {
|
||||
dateStyle: 'medium',
|
||||
timeStyle: 'short',
|
||||
}).format(value)
|
||||
: 'Never';
|
||||
|
||||
export const titleize = (value?: string) =>
|
||||
value?.replaceAll('_', ' ') ?? 'unknown';
|
||||
|
||||
export const truncate = (value: string, length = 80) =>
|
||||
value.length > length ? `${value.slice(0, length - 3)}...` : value;
|
||||
Reference in New Issue
Block a user