spacedrive/interface/util/index.tsx

11 lines
460 B
TypeScript
Raw Normal View History

import cryptoRandomString from 'crypto-random-string';
// NOTE: `crypto` module is not available in RN so this can't be in client
export const generatePassword = (length: number) =>
cryptoRandomString({ length, type: 'ascii-printable' });
2023-08-15 08:23:41 +00:00
export type NonEmptyArray<T> = [T, ...T[]];
export const isNonEmpty = <T,>(input: T[]): input is NonEmptyArray<T> => input.length > 0;
export const isNonEmptyObject = (input: object) => Object.keys(input).length > 0;