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SAAS,QAAQ,EAAO,cACnC,IAE6B,SAAS,GAClC,EAAiB,EAAc,EAAK,EAAK,OAAS,EAEtD,MAAO,CACH,SAAU,EAAK,MAAM,EAAG,GACxB,SAAU,EAAK,MAAM,EAAe,EAAK,QAEjD,CAMA,SAAS,qBAAqB,GAC1B,OAAO,QAAQ,EAAM,GAAG,cAC5B,CAEA,SAAS,YAAY,GACjB,OAAO,EAAU,KAAK,IAC1B,CAEA,SAAS,QAAQ,GACb,QAAS,EAAE,KAAK,QAAQ,SAAS,GAAQ,OAAO,GAAS,CAAM,GACnE,CAEA,SAAS,aAAa,GAClB,MAAe,KAAR,GAAuB,KAAR,GAAuB,KAAR,CACzC,CAEA,SAAS,eAAe,GACpB,OAAO,EAAK,OAAO,GAAG,cAAgB,EAAK,MAAM,EACrD,CAEA,SAAS,eAAe,GACpB,IAAI,EAAc,EAAK,OAAO,GAC9B,OAAO,GAAe,EAAY,aACtC,CAEA,OAAO,QAAU","file":"/npm/pig-latin@2.0.2/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/pig-latin@2.0.2/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var _ = require('lodash')\n\nvar vowels = ['a', 'e', 'i', 'o', 'u']\nvar alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']\n\n//////////////////////////////////////\n///// The Big Pig functions //////////\n//////////////////////////////////////\n\n// This is the master method called in the module\nfunction piggyAnyText(text, options) {\n    var arrayOfWords = prepForThePig(text)\n    var piggified = arrayOfWords.map(function(word) {\n        return piggyOneWord(word, options)\n    })\n    return reconstruct(piggified)\n}\n\nfunction piggyOneWord(word, options) {\n    var formatted = formatWord(word)\n    var bigBacon = piggyVowelOrConsonantWord(formatted.wordPart, options)\n    // Send the word off to get piggified WITHOUT its punctuation\n    return bigBacon+formatted.puncPart      // Reattach punctuation when returning\n}\n\nfunction piggyVowelOrConsonantWord(wordPart, options) {\n    if (arrayStartsWithVowel(wordPart))     // If first letter is a vowel\n        return piggyVowelWord(wordPart, options)\n    else                                    // If first letter is consonant\n        return piggyConsonantWord(wordPart)\n}\n\n// Use this method to piggy a word that starts with a vowel\nfunction piggyVowelWord(word, options) {\n    if (!options || !options.vowelEnding)   // If no options specified, do it MY way (AKA the \"one-and-only-true\" way)\n        return word+'way'\n    else                                    // Else return the specified option (but it's still the WRONG way to do it)\n        return word+options.vowelEnding\n}\n\n// Method to piggy a word that starts w/ consonant\nfunction piggyConsonantWord(word) {\n\n    // Split the word into its two parts. I know this is ugly, but it works\n    // First find all the vowels\n    var vowelLocations = vowels.map(function(vowel) {\n        return word.indexOf(vowel)\n    })\n    // Then find the location of the first vowel\n    var firstVowelLocation = _.min(vowelLocations, function(location) {\n        if (location < 0)\n            return 100\n        else return location\n    })\n    // Slice, dice, and reconstruct word\n    var part1 = word.slice(0, firstVowelLocation)\n    var part2 = word.slice(firstVowelLocation, word.length)\n\n    // If the word was capitalized before piggifying\n    if (wasCapitalized(word)) {\n\t// Set original first letter to lower case\n\tpart1 = part1.charAt(0).toLowerCase() + part1.slice(1)\n\t// Capitalize the first letter of the word\n\tpart2 = capitalizeWord(part2)\n    }\n    return part2+part1+'ay'\n}\n\n//////////////////////////////////////\n///// Formatting functions ///////////\n//////////////////////////////////////\n\nfunction prepForThePig(text) {\n    var noDashes = text.replace(/-|–|—/g, \", \")     // Remove all dashes, because they are hecka hard to handle -- make them commas, instead\n    return noDashes.split(' ')\n}\n\nfunction formatWord(word) {\n    var formatted = word.replace(\"'\", \"\")            // Remove apostrophes, because the piggy Latin don't need no stinkin' apostrophes!\n\n    // Split into an array of single letters\n    var arrayOfLetters = formatted.split('')\n    // Find all the locations of letters, as opposed to other symbols\n    var letterLocs = arrayOfLetters.map(function(letter) {\n        return alphabet.indexOf(letter.toLowerCase())\n    })\n    // Find where the punctuation begins -- this assumes punctuation is always at the END of a word\n    var startOfPunc = letterLocs.indexOf(-1)\n    var locationToUse = (startOfPunc < 0) ? word.length : startOfPunc\n    // Return the word and its punctuation separately -- they'll be reattached at the very end\n    return {\n        wordPart: word.slice(0, locationToUse),\n        puncPart: word.slice(locationToUse, word.length)\n    }\n}\n\n//////////////////////////////////////\n///// Helper functions ///////////////\n//////////////////////////////////////\n\nfunction arrayStartsWithVowel(array) {\n    return isVowel(array[0].toLowerCase())\n}\n\nfunction reconstruct(piggified) {\n    return piggified.join(' ')\n}\n\nfunction isVowel(letter) {\n    return !!_.find(vowels, function(vowel) {return vowel == letter})\n}\n\nfunction endsSentence(char) {\n    return char == \"!\" || char == \"?\" || char == \".\"\n}\n\nfunction capitalizeWord(word) {\n    return word.charAt(0).toUpperCase() + word.slice(1)\n}\n\nfunction wasCapitalized(word) {\n    var firstLetter = word.charAt(0);\n    return firstLetter == firstLetter.toUpperCase();\n}\n\nmodule.exports = piggyAnyText\n"]}