-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Luis Rojas
committed
Jan 31, 2017
1 parent
ad0375c
commit 7bdb292
Showing
3 changed files
with
30 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export function formatPrice(cents) { | ||
return `$${(cents / 100).toFixed(2).replace(/\B(?=(\d{3})+(?!\d))/g, ',')}`; | ||
} | ||
|
||
export function rando(arr) { | ||
return arr[Math.floor(Math.random() * arr.length)]; | ||
} | ||
|
||
export function slugify(text) { | ||
return text.toString().toLowerCase() | ||
.replace(/\s+/g, '-') // Replace spaces with - | ||
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | ||
.replace(/\-\-+/g, '-') // Replace multiple - with single - | ||
.replace(/^-+/, '') // Trim - from start of text | ||
.replace(/-+$/, ''); // Trim - from end of text | ||
} | ||
|
||
export function getFunName() { | ||
const adjectives = ['peluca', 'bella', 'sucia', 'chocolate', 'elegante', 'rica', 'golosa', 'pete', 'largo', 'petardo', 'sapeee', 'loquita', 'sapeee', 'peluca', 'trolazo', 'putazo', 'chupapija', 'lechero', 'mcgivergota']; | ||
|
||
const nouns = ['mujer', 'hombre', 'niño', 'trolazo', 'loquita', 'gente', 'padre', 'concha', 'prima', 'primo', 'traviesa', 'esposa', 'monja', 'pie', 'enfermera', 'panadero', 'delalora']; | ||
|
||
return `${rando(adjectives)}-${rando(adjectives)}-${rando(nouns)}`; | ||
} |
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