diff --git a/readme.md b/readme.md index a59ad1e..746f02e 100644 --- a/readme.md +++ b/readme.md @@ -2,6 +2,10 @@ The code in this repo meant to be a reference point for anyone following along with the video course. +##Demo + +URL: Demo: https://ns-rsgznilalc.now.sh/ + ## To Start 1. Install all the dependencies `npm install` diff --git a/src/helpers-copy.js b/src/helpers-copy.js new file mode 100644 index 0000000..a89847c --- /dev/null +++ b/src/helpers-copy.js @@ -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)}`; +} diff --git a/src/helpers.js b/src/helpers.js index a89847c..b302245 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -16,9 +16,9 @@ export function slugify(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 adjectives = ['adorable', 'beautiful', 'clean', 'drab', 'elegant', 'fancy', 'glamorous', 'handsome', 'long', 'magnificent', 'old-fashioned', 'plain', 'quaint', 'sparkling', 'ugliest', 'unsightly', 'angry', 'bewildered', 'clumsy', 'defeated', 'embarrassed', 'fierce', 'grumpy', 'helpless', 'itchy', 'jealous', 'lazy', 'mysterious', 'nervous', 'obnoxious', 'panicky', 'repulsive', 'scary', 'thoughtless', 'uptight', 'worried']; - const nouns = ['mujer', 'hombre', 'niño', 'trolazo', 'loquita', 'gente', 'padre', 'concha', 'prima', 'primo', 'traviesa', 'esposa', 'monja', 'pie', 'enfermera', 'panadero', 'delalora']; + const nouns = ['women', 'men', 'children', 'teeth', 'feet', 'people', 'leaves', 'mice', 'geese', 'halves', 'knives', 'wives', 'lives', 'elves', 'loaves', 'potatoes', 'tomatoes', 'cacti', 'foci', 'fungi', 'nuclei', 'syllabuses', 'analyses', 'diagnoses', 'oases', 'theses', 'crises', 'phenomena', 'criteria', 'data']; return `${rando(adjectives)}-${rando(adjectives)}-${rando(nouns)}`; }