From 0077128056862fbe136525b8804da0a4861c7ff2 Mon Sep 17 00:00:00 2001 From: Caasi Date: Sat, 5 Oct 2019 03:09:47 -0500 Subject: [PATCH 1/2] Added ability to work with vanilla JS and nodeJS --- emoJSi.js | 273 ++++++++++++++++++++++++++++++++++++++++++++++ example_emoJSi.js | 25 +++++ 2 files changed, 298 insertions(+) create mode 100644 emoJSi.js create mode 100644 example_emoJSi.js diff --git a/emoJSi.js b/emoJSi.js new file mode 100644 index 0000000..8f645fb --- /dev/null +++ b/emoJSi.js @@ -0,0 +1,273 @@ +/* + BY: rewrite123 + Find me here: https://github.com/rewrite123 + October 4, 2019 + Notes: + Here is a nice quality of life script in js for you so you can reference this in something like NodeJS or vanilla JS. +*/ + +/* Reference this by the name given */ +var referenceByObject = { + "innocent-face": "ʘ‿ʘ", + "reddit-disapproval-face": "ಠ_ಠ", + "table-flip": "(╯°□°)╯︵ ┻━┻", + "put-the-table-back": "┬─┬ ノ( ゜-゜ノ)", + "tidy-up": "┬─┬⃰͡ (ᵔᵕᵔ͜ )", + "double-Flip": "┻━┻ ︵ヽ(`Д´)ノ︵ ┻━┻", + "fisticuffs": "ლ(`ー´ლ)", + "cute-bear": "ʕ•ᴥ•ʔ", + "squinting-bear": "ʕᵔᴥᵔʔ", + "GTFO-Bear": "ʕ •`ᴥ•´ʔ", + "cute-face-with-big-eyes": "(。◕‿◕。)", + "surprised": "( ゚Д゚)", + "shrug-face": "¯\\_(ツ)_/¯", + "meh": "¯\\(°_o)/¯", + "feel-perky": "(`・ω・´)", + "angry-face": "(╬ ಠ益ಠ)", + "at-what-cost": "ლ(ಠ益ಠლ)", + "excited": "☜(⌒▽⌒)☞", + "running": "ε=ε=ε=┌(;*´Д`)ノ", + "happy-face": "ヽ(´▽`)/", + "basking-in-glory": "ヽ(´ー`)ノ", + "kitty-emote": "ᵒᴥᵒ#", + "fido": "V•ᴥ•V", + "meow": "ฅ^•ﻌ•^ฅ", + "cheers": "( ^_^)o自自o(^_^ )", + "devious-smile": "ಠ‿ಠ", + "4chan-emoticon": "( ͡° ͜ʖ ͡°)", + "crying-face": "ಥ_ಥ", + "breakdown": "ಥ﹏ಥ", + "disagree": "٩◔̯◔۶", + "flexing": "ᕙ(⇀‸↼‶)ᕗ", + "do-you-even-lift-bro?": " ᕦ(ò_óˇ)ᕤ", + "kirby": "⊂(◉‿◉)つ", + "tripping-out": "q(❂‿❂)p", + "discombobulated": "⊙﹏⊙", + "sad-and-confused": "¯\\_(⊙︿⊙)_/¯", + "japanese-lion-face": "°‿‿°", + "confused": "¿ⓧ_ⓧﮌ", + "confused-scratch": "(⊙.☉)7", + "worried": "(´・_・`)", + "dear-god-why": "щ(゚Д゚щ)", + "staring": "٩(๏_๏)۶", + "pretty-eyes": "ఠ_ఠ", + "strut": "ᕕ( ᐛ )ᕗ", + "zoned": "(⊙_◎)", + "crazy": "ミ●﹏☉ミ", + "trolling": "༼∵༽ ༼⍨༽ ༼⍢༽ ༼⍤༽", + "angry-troll": "ヽ༼ ಠ益ಠ ༽ノ", + "fuck-it": "t(-_-t)", + "sad-face": "(ಥ⌣ಥ)", + "hugger": "(づ ̄ ³ ̄)づ", + "stranger-danger": "(づ。◕‿‿◕。)づ", + "flip-friend": "(ノಠ ∩ಠ)ノ彡( \\o°o)\\", + "cry-face": "。゚( ゚இ‸இ゚)゚。", + "cry-troll": "༼ ༎ຶ ෴ ༎ຶ༽", + "tgif": "“ヽ(´▽`)ノ”", + "dancing": "┌(ㆆ㉨ㆆ)ʃ", + "sleepy": "눈_눈", + "angry-birds": "( ఠൠఠ )ノ", + "no-support": "乁( ◔ ౪◔)「 ┑( ̄Д  ̄)┍", + "shy": "(๑•́ ₃ •̀๑)", + "fly-away": "⁽⁽ଘ( ˊᵕˋ )ଓ⁾⁾", + "careless": "◔_◔", + "love": "-`ღ´-", + "touchy-feely": "ԅ(≖‿≖ԅ)", + "kissing": "( ˘ ³˘)♥", + "shark-face": "( ˇ෴ˇ )", + "emo-dance": "ヾ(-_- )ゞ", + "dance": "♪♪ ヽ(ˇ∀ˇ )ゞ", + "opera": "ヾ(´〇`)ノ♪♪♪", + "winnie-the-pooh": "ʕ •́؈•̀)", + "boxing": "ლ(•́•́ლ)", + "fight": "(ง'̀-'́)ง", + "listening-to-headphones": "◖ᵔᴥᵔ◗ ♪ ♫", + "robot": "{•̃_•̃}", + "seal": "(ᵔᴥᵔ)", + "questionable": "(Ծ‸ Ծ)", + "winning": "(•̀ᴗ•́)و ̑̑", + "zombie": "[¬º-°]¬", + "pointing": "(☞゚ヮ゚)☞", + "whistling": "(っ•́。•́)♪♬", + "injured": "(҂◡_◡)", + "creeper": "ƪ(ړײ)‎ƪ​​", + "eye-roll": "⥀.⥀", + "flying": "ح˚௰˚づ", + "things-that-cant-be-unseen": "♨_♨", + "looking-down": "(._.)", + "im-a-hugger": "(⊃。•́‿•̀。)⊃", + "wizard": "(∩`-´)⊃━☆゚.*・。゚", + "yum": "(っ˘ڡ˘ς)", + "judging": "( ఠ ͟ʖ ఠ)", + "tired": "( ͡ಠ ʖ̯ ͡ಠ)", + "dislike": "( ಠ ʖ̯ ಠ)", + "hitchhiking": "(งツ)ว", + "satisfied": "(◠﹏◠)", + "sad-and-crying": "(ᵟຶ︵ ᵟຶ)", + "stunna-shades": "(っ▀¯▀)つ", + "chicken": "ʚ(•`", + "barf": "(´ж`ς)", + "fuck-off": "(° ͜ʖ͡°)╭∩╮", + "smiley-toast": "ʕʘ̅͜ʘ̅ʔ", + "exorcism": "ح(•̀ж•́)ง †", + "taking-a-dump": "(⩾﹏⩽)", + "dab": "ヽ( •_)ᕗ", + "wave-dance": "~(^-^)~", + "happy-hug": "\\(ᵔᵕᵔ)/", + "resting-my-eyes": "ᴖ̮ ̮ᴖ", + "peepers": "ಠಠ", + "judgemental": "{ಠʖಠ}" +} + +/* Reference this by the given index */ +var referenceByIndex = [ + "ʘ‿ʘ", + "ಠ_ಠ", + "(╯°□°)╯︵ ┻━┻", "┬─┬ ノ( ゜-゜ノ)", "┬─┬⃰͡ (ᵔᵕᵔ͜ )", + "┻━┻ ︵ヽ(`Д´)ノ︵ ┻━┻", "ლ(`ー´ლ)", + "ʕ•ᴥ•ʔ", + "ʕᵔᴥᵔʔ", + "ʕ •`ᴥ•´ʔ", + "(。◕‿◕。)", + "( ゚Д゚)", + "¯\\_(ツ)_/¯", + "¯\\(°_o)/¯", + "(`・ω・´)", + "(╬ ಠ益ಠ)", + "ლ(ಠ益ಠლ)", + "☜(⌒▽⌒)☞", + "ε=ε=ε=┌(;*´Д`)ノ", + "ヽ(´▽`)/", + "ヽ(´ー`)ノ", + "ᵒᴥᵒ#", + "V•ᴥ•V", + "ฅ^•ﻌ•^ฅ", + "( ^_^)o自自o(^_^ )", + "ಠ‿ಠ", + "( ͡° ͜ʖ ͡°)", + "ಥ_ಥ", + "ಥ﹏ಥ", + "٩◔̯◔۶", + "ᕙ(⇀‸↼‶)ᕗ", + " ᕦ(ò_óˇ)ᕤ", + "⊂(◉‿◉)つ", + "q(❂‿❂)p", + "⊙﹏⊙", + "¯\\_(⊙︿⊙)_/¯", + "°‿‿°", + "¿ⓧ_ⓧﮌ", "(⊙.☉)7", + "(´・_・`)", + "щ(゚Д゚щ)", + "٩(๏_๏)۶", + "ఠ_ఠ", + "ᕕ( ᐛ )ᕗ", + "(⊙_◎)", + "ミ●﹏☉ミ", + "༼∵༽ ༼⍨༽ ༼⍢༽ ༼⍤༽", + "ヽ༼ ಠ益ಠ ༽ノ", + "t(-_-t)", + "(ಥ⌣ಥ)", + "(づ ̄ ³ ̄)づ", + "(づ。◕‿‿◕。)づ", + "(ノಠ ∩ಠ)ノ彡( \\o°o)\\", + "。゚( ゚இ‸இ゚)゚。", + "༼ ༎ຶ ෴ ༎ຶ༽", + "“ヽ(´▽`)ノ”", + "┌(ㆆ㉨ㆆ)ʃ", + "눈_눈", + "( ఠൠఠ )ノ", + "乁( ◔ ౪◔)「 ┑( ̄Д  ̄)┍", + "(๑•́ ₃ •̀๑)", + "⁽⁽ଘ( ˊᵕˋ )ଓ⁾⁾", + "◔_◔", "♥‿♥", + "ԅ(≖‿≖ԅ)", + "( ˘ ³˘)♥", + "( ˇ෴ˇ )", + "ヾ(-_- )ゞ", + "♪♪ ヽ(ˇ∀ˇ )ゞ", + "ヾ(´〇`)ノ♪♪♪", "ʕ •́؈•̀)", + "ლ(•́•́ლ)", + "(ง'̀-'́)ง", + "◖ᵔᴥᵔ◗ ♪ ♫", + "{•̃_•̃}", + "(ᵔᴥᵔ)", + "(Ծ‸ Ծ)", + "(•̀ᴗ•́)و ̑̑", + "[¬º-°]¬", + "(☞゚ヮ゚)☞", + "(っ•́。•́)♪♬", + "(҂◡_◡)", + "ƪ(ړײ)‎ƪ​​", + "⥀.⥀", + "ح˚௰˚づ", + "♨_♨", + "(._.)", + "(⊃。•́‿•̀。)⊃", + "(∩`-´)⊃━☆゚.*・。゚", + "(っ˘ڡ˘ς)", + "( ఠ ͟ʖ ఠ)", + "( ͡ಠ ʖ̯ ͡ಠ)", + "( ಠ ʖ̯ ಠ)", + "(งツ)ว", + "(◠﹏◠)", + "(ᵟຶ︵ ᵟຶ)", + "(っ▀¯▀)つ", + "ʚ(•`", + "(´ж`ς)", + "(° ͜ʖ͡°)╭∩╮", + "ʕʘ̅͜ʘ̅ʔ", + "ح(•̀ж•́)ง †", + "-`ღ´-", + "(⩾﹏⩽)", + "ヽ( •_)ᕗ", + "~(^-^)~", + "\\(ᵔᵕᵔ)/", + "ᴖ̮ ̮ᴖ", + "ಠಠ", + "{ಠʖಠ}" + ]; + +/* + Passing in one argument allows retrieval of the value. + If the argument is a string it attempts to get it from the referenceByObject as a value of the key + If the argument is a number it attempts to get it from the referenceByIndex as a value of the index + Passing in two arguments allows changing and adding emojis. + If the first argument is a string it attempts to add/change a field of referenceByObject using the second argument as the value + If the fist argument is a number it attempts add/change the value of that index in referenceByIndex to the second argument +*/ +function emoji(){ + if(arguments.length == 1){ + if( isNaN(arguments[0]) ){ + if(referenceByObject[arguments[0]]){ + return referenceByObject[arguments[0]]; + }else{ + return null; + } + }else{ + if( parseInt(arguments[0]) >= 0 ){ + return referenceByIndex[ parseInt(arguments[0]) ]; + }else{ + return null; + } + } + }else if(arguments.length == 2){ + if( isNaN(arguments[0]) ){ + referenceByObject[arguments[0]] = arguments[1]; + return referenceByObject; + }else{ + if( parseInt(arguments[0]) >= 0 ){ + referenceByIndex[ parseInt(arguments[0]) ] = arguments[1]; + return referenceByIndex; + }else{ + return null; + } + } + } + } + + /* For my beloved nodeJS people */ + if(typeof module !== 'undefined'){ + if(module.exports){ + module.exports.emoji = emoji; //Kind of a unorthodox way to provide compatibility to nodeJS but, hey... it ain't stupid if it works + } + } diff --git a/example_emoJSi.js b/example_emoJSi.js new file mode 100644 index 0000000..c952823 --- /dev/null +++ b/example_emoJSi.js @@ -0,0 +1,25 @@ +/* + BY: rewrite123 + Find me here: https://github.com/rewrite123 + October 4, 2019 + Notes: + Here is a js test for people so they can see this in action +*/ + +/* Ok, ok, ok. So this looks weird, but it is to allow nodeJS and vanilla JS to be compatable for testing this file. */ +/* nodeJS users define it as follows: const emoji = require("./emoJSi.js").emoji; */ +if( (typeof emoji) == "undefined"){ + emoji = require("./emoJSi.js").emoji; //Spookie weird JS stuff going on here +} + +/* These will return the same thing */ +console.log(emoji(8)); +console.log(emoji("squinting-bear")); + +/* This will change them */ +emoji(8, "This would be the new face in the array ;P") +emoji("squinting-bear", "This would be the new face in the object ;)") + +/* These will no longer eturn the same thing :( */ +console.log(emoji(8)); +console.log(emoji("squinting-bear")); From 440dea88435710b8cbd272359c9ef51482b5b0c3 Mon Sep 17 00:00:00 2001 From: Caasi Date: Sat, 19 Oct 2019 15:44:40 -0500 Subject: [PATCH 2/2] Added ability to work with vanilla JS and nodeJS. Example is included. --- emoJSi.js | 117 +++------------------------------------------- example_emoJSi.js | 8 ++-- 2 files changed, 12 insertions(+), 113 deletions(-) diff --git a/emoJSi.js b/emoJSi.js index 8f645fb..21e6274 100644 --- a/emoJSi.js +++ b/emoJSi.js @@ -119,115 +119,8 @@ var referenceByObject = { "judgemental": "{ಠʖಠ}" } -/* Reference this by the given index */ -var referenceByIndex = [ - "ʘ‿ʘ", - "ಠ_ಠ", - "(╯°□°)╯︵ ┻━┻", "┬─┬ ノ( ゜-゜ノ)", "┬─┬⃰͡ (ᵔᵕᵔ͜ )", - "┻━┻ ︵ヽ(`Д´)ノ︵ ┻━┻", "ლ(`ー´ლ)", - "ʕ•ᴥ•ʔ", - "ʕᵔᴥᵔʔ", - "ʕ •`ᴥ•´ʔ", - "(。◕‿◕。)", - "( ゚Д゚)", - "¯\\_(ツ)_/¯", - "¯\\(°_o)/¯", - "(`・ω・´)", - "(╬ ಠ益ಠ)", - "ლ(ಠ益ಠლ)", - "☜(⌒▽⌒)☞", - "ε=ε=ε=┌(;*´Д`)ノ", - "ヽ(´▽`)/", - "ヽ(´ー`)ノ", - "ᵒᴥᵒ#", - "V•ᴥ•V", - "ฅ^•ﻌ•^ฅ", - "( ^_^)o自自o(^_^ )", - "ಠ‿ಠ", - "( ͡° ͜ʖ ͡°)", - "ಥ_ಥ", - "ಥ﹏ಥ", - "٩◔̯◔۶", - "ᕙ(⇀‸↼‶)ᕗ", - " ᕦ(ò_óˇ)ᕤ", - "⊂(◉‿◉)つ", - "q(❂‿❂)p", - "⊙﹏⊙", - "¯\\_(⊙︿⊙)_/¯", - "°‿‿°", - "¿ⓧ_ⓧﮌ", "(⊙.☉)7", - "(´・_・`)", - "щ(゚Д゚щ)", - "٩(๏_๏)۶", - "ఠ_ఠ", - "ᕕ( ᐛ )ᕗ", - "(⊙_◎)", - "ミ●﹏☉ミ", - "༼∵༽ ༼⍨༽ ༼⍢༽ ༼⍤༽", - "ヽ༼ ಠ益ಠ ༽ノ", - "t(-_-t)", - "(ಥ⌣ಥ)", - "(づ ̄ ³ ̄)づ", - "(づ。◕‿‿◕。)づ", - "(ノಠ ∩ಠ)ノ彡( \\o°o)\\", - "。゚( ゚இ‸இ゚)゚。", - "༼ ༎ຶ ෴ ༎ຶ༽", - "“ヽ(´▽`)ノ”", - "┌(ㆆ㉨ㆆ)ʃ", - "눈_눈", - "( ఠൠఠ )ノ", - "乁( ◔ ౪◔)「 ┑( ̄Д  ̄)┍", - "(๑•́ ₃ •̀๑)", - "⁽⁽ଘ( ˊᵕˋ )ଓ⁾⁾", - "◔_◔", "♥‿♥", - "ԅ(≖‿≖ԅ)", - "( ˘ ³˘)♥", - "( ˇ෴ˇ )", - "ヾ(-_- )ゞ", - "♪♪ ヽ(ˇ∀ˇ )ゞ", - "ヾ(´〇`)ノ♪♪♪", "ʕ •́؈•̀)", - "ლ(•́•́ლ)", - "(ง'̀-'́)ง", - "◖ᵔᴥᵔ◗ ♪ ♫", - "{•̃_•̃}", - "(ᵔᴥᵔ)", - "(Ծ‸ Ծ)", - "(•̀ᴗ•́)و ̑̑", - "[¬º-°]¬", - "(☞゚ヮ゚)☞", - "(っ•́。•́)♪♬", - "(҂◡_◡)", - "ƪ(ړײ)‎ƪ​​", - "⥀.⥀", - "ح˚௰˚づ", - "♨_♨", - "(._.)", - "(⊃。•́‿•̀。)⊃", - "(∩`-´)⊃━☆゚.*・。゚", - "(っ˘ڡ˘ς)", - "( ఠ ͟ʖ ఠ)", - "( ͡ಠ ʖ̯ ͡ಠ)", - "( ಠ ʖ̯ ಠ)", - "(งツ)ว", - "(◠﹏◠)", - "(ᵟຶ︵ ᵟຶ)", - "(っ▀¯▀)つ", - "ʚ(•`", - "(´ж`ς)", - "(° ͜ʖ͡°)╭∩╮", - "ʕʘ̅͜ʘ̅ʔ", - "ح(•̀ж•́)ง †", - "-`ღ´-", - "(⩾﹏⩽)", - "ヽ( •_)ᕗ", - "~(^-^)~", - "\\(ᵔᵕᵔ)/", - "ᴖ̮ ̮ᴖ", - "ಠಠ", - "{ಠʖಠ}" - ]; - /* + Passing in no arguments returns the object containing all the faces in their key value pairs. Passing in one argument allows retrieval of the value. If the argument is a string it attempts to get it from the referenceByObject as a value of the key If the argument is a number it attempts to get it from the referenceByIndex as a value of the index @@ -236,7 +129,11 @@ var referenceByIndex = [ If the fist argument is a number it attempts add/change the value of that index in referenceByIndex to the second argument */ function emoji(){ - if(arguments.length == 1){ + var associatedKeys = Object.keys(referenceByObject); + var referenceByIndex = Object.values(referenceByObject); + if(arguments.length == 0){ + return referenceByObject; + }else if(arguments.length == 1){ if( isNaN(arguments[0]) ){ if(referenceByObject[arguments[0]]){ return referenceByObject[arguments[0]]; @@ -256,7 +153,7 @@ function emoji(){ return referenceByObject; }else{ if( parseInt(arguments[0]) >= 0 ){ - referenceByIndex[ parseInt(arguments[0]) ] = arguments[1]; + referenceByObject[ associatedKeys[parseInt(arguments[0])] ] = arguments[1]; return referenceByIndex; }else{ return null; diff --git a/example_emoJSi.js b/example_emoJSi.js index c952823..9c1c7d5 100644 --- a/example_emoJSi.js +++ b/example_emoJSi.js @@ -17,9 +17,11 @@ console.log(emoji(8)); console.log(emoji("squinting-bear")); /* This will change them */ -emoji(8, "This would be the new face in the array ;P") -emoji("squinting-bear", "This would be the new face in the object ;)") +emoji(8, "This would be the new face in the array ;P"); +console.log(emoji(8)); +console.log(emoji("squinting-bear")); -/* These will no longer eturn the same thing :( */ +/* And so will this */ +emoji("squinting-bear", "This would be the new face in the object ;)"); console.log(emoji(8)); console.log(emoji("squinting-bear"));