Skip to content

Instantly share code, notes, and snippets.

@aloverso
Created May 6, 2020 20:02
Show Gist options
  • Select an option

  • Save aloverso/a54dd3c534bd0cbaa22c25a1d85fb47d to your computer and use it in GitHub Desktop.

Select an option

Save aloverso/a54dd3c534bd0cbaa22c25a1d85fb47d to your computer and use it in GitHub Desktop.
export interface User {
name: String,
password: String
}
const random = (): number => {
return Math.floor(Math.random() * Math.floor(10000000));
};
export const buildDefaultUser = (partial: Partial<User>): User => {
return {
name: 'some-username-' + random(),
password: 'some-password-' + random(),
...partial
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment