@kudoai/chatgpt.js 3.6.1 → 3.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -49,8 +49,8 @@
49
49
  <img src="https://img.shields.io/github/stars/KudoAI/chatgpt.js?label=Stars&color=af68ff&logo=github&logoColor=white&labelColor=464646&style=for-the-badge"></a>
50
50
  <a href="https://github.com/KudoAI/chatgpt.js/blob/main/LICENSE.md">
51
51
  <img src="https://img.shields.io/badge/License-MIT-green.svg?logo=internetarchive&logoColor=white&labelColor=464646&style=for-the-badge"></a>
52
- <a href="https://github.com/KudoAI/chatgpt.js/tree/v3.6.1/dist/chatgpt.min.js">
53
- <img src="https://img.shields.io/github/size/KudoAI/chatgpt.js/dist/chatgpt.min.js?branch=v3.6.1&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
52
+ <a href="https://github.com/KudoAI/chatgpt.js/tree/v3.6.3/dist/chatgpt.min.js">
53
+ <img src="https://img.shields.io/github/size/KudoAI/chatgpt.js/dist/chatgpt.min.js?branch=v3.6.3&label=Minified%20Size&logo=databricks&logoColor=white&labelColor=464646&color=ff69b4&style=for-the-badge"></a>
54
54
  <a href="https://www.codefactor.io/repository/github/kudoai/chatgpt.js">
55
55
  <img src="https://img.shields.io/codefactor/grade/github/kudoai/chatgpt.js?label=Code+Quality&logo=codefactor&logoColor=white&labelColor=464646&color=1acc6c&style=for-the-badge"></a>
56
56
  <a href="https://sonarcloud.io/component_measures?metric=new_vulnerabilities&id=kudoai_chatgpt.js">
@@ -94,7 +94,7 @@
94
94
 
95
95
  ```js
96
96
  (async () => {
97
- await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.1/dist/chatgpt.min.js');
97
+ await import('https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.3/dist/chatgpt.min.js');
98
98
  // Your code here...
99
99
  })();
100
100
  ```
@@ -103,7 +103,7 @@
103
103
 
104
104
  ```js
105
105
  var xhr = new XMLHttpRequest();
106
- xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.1/dist/chatgpt.min.js');
106
+ xhr.open('GET', 'https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.3/dist/chatgpt.min.js');
107
107
  xhr.onload = function () {
108
108
  if (xhr.status === 200) {
109
109
  var chatgptJS = document.createElement('script');
@@ -126,7 +126,7 @@ function yourCode() {
126
126
 
127
127
  ```js
128
128
  ...
129
- // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.1/dist/chatgpt.min.js
129
+ // @require https://cdn.jsdelivr.net/npm/@kudoai/chatgpt.js@3.6.3/dist/chatgpt.min.js
130
130
  // ==/UserScript==
131
131
 
132
132
  // Your code here...
@@ -196,7 +196,7 @@ chatgpt.get('reply', 'last');
196
196
 
197
197
  Each call equally fetches the last response. If you think it works, it probably will... so just type it!
198
198
 
199
- If it didn't, check out the extended [userguide](https://github.com/KudoAI/chatgpt.js/blob/v3.6.1/docs/USERGUIDE.md), or simply submit an [issue](https://github.com/KudoAI/chatgpt.js/issues) or [PR](https://github.com/KudoAI/chatgpt.js/pulls) and it will be integrated, ezpz!
199
+ If it didn't, check out the extended [userguide](https://github.com/KudoAI/chatgpt.js/blob/v3.6.3/docs/USERGUIDE.md), or simply submit an [issue](https://github.com/KudoAI/chatgpt.js/issues) or [PR](https://github.com/KudoAI/chatgpt.js/pulls) and it will be integrated, ezpz!
200
200
 
201
201
  <img height=8px width="100%" src="https://assets.chatgptjs.org/images/separators/gradient-aqua.png?v=e638eac">
202
202
 
@@ -427,7 +427,7 @@ This library exists thanks to code, translations, issues & ideas from the follow
427
427
  <div align="center">
428
428
 
429
429
  **[Releases](https://github.com/KudoAI/chatgpt.js/releases)** /
430
- [Userguide](https://github.com/KudoAI/chatgpt.js/blob/v3.6.1/docs/USERGUIDE.md) /
430
+ [Userguide](https://github.com/KudoAI/chatgpt.js/blob/v3.6.3/docs/USERGUIDE.md) /
431
431
  [Discuss](https://github.com/KudoAI/chatgpt.js/discussions) /
432
432
  [Back to top ↑](#top)
433
433
 
package/chatgpt.js CHANGED
@@ -133,49 +133,53 @@ const chatgpt = {
133
133
  modalMessage = document.createElement('p');
134
134
 
135
135
  // Create/append/update modal style (if missing or outdated)
136
- const thisUpdated = 1735768363880 // timestamp of last edit for this file's `modalStyle`
137
- let modalStyle = document.querySelector('#chatgpt-modal-style'); // try to select existing style
136
+ const thisUpdated = 1739338889852 // timestamp of last edit for this file's `modalStyle`
137
+ let modalStyle = document.querySelector('#chatgpt-modal-style') // try to select existing style
138
138
  if (!modalStyle || parseInt(modalStyle.getAttribute('last-updated'), 10) < thisUpdated) { // if missing or outdated
139
139
  if (!modalStyle) { // outright missing, create/id/attr/append it first
140
- modalStyle = document.createElement('style'); modalStyle.id = 'chatgpt-modal-style';
141
- modalStyle.setAttribute('last-updated', thisUpdated.toString());
142
- document.head.append(modalStyle);
140
+ modalStyle = document.createElement('style') ; modalStyle.id = 'chatgpt-modal-style'
141
+ modalStyle.setAttribute('last-updated', thisUpdated.toString())
142
+ document.head.append(modalStyle)
143
143
  }
144
144
  modalStyle.innerText = ( // update prev/new style contents
145
- '.chatgpt-modal {' // vars
146
- + '--transition: opacity 0.65s cubic-bezier(.165,.84,.44,1),' // for fade-in
147
- + 'transform 0.55s cubic-bezier(.165,.84,.44,1) ;' // for move-in
148
- + '--bg-transition: background-color 0.25s ease }' // for bg dim
145
+ `.chatgpt-modal { /* vars */
146
+ --transition: opacity 0.65s cubic-bezier(.165,.84,.44,1), /* for fade-in */
147
+ transform 0.55s cubic-bezier(.165,.84,.44,1) ; /* for move-in */
148
+ --bg-transition: background-color 0.25s ease ; /* for bg dim */
149
+ --btn-transition: transform 0.1s ease-in-out, box-shadow 0.1s ease-in-out ; /* for smooth zoom */
150
+ --btn-shadow: 2px 1px ${ scheme == 'dark' ? '54px #00cfff' : '30px #9cdaff' }}`
149
151
 
150
152
  + '.no-mobile-tap-outline { outline: none ; -webkit-tap-highlight-color: transparent }'
151
153
 
152
154
  // Background styles
153
- + '.chatgpt-modal {'
154
- + 'pointer-events: auto ;' // override any disabling from site modals (like guest login spam)
155
- + 'position: fixed ; top: 0 ; left: 0 ; width: 100% ; height: 100% ;' // expand to full view-port
156
- + 'display: flex ; justify-content: center ; align-items: center ; z-index: 9999 ;' // align
157
- + 'transition: var(--bg-transition) ;' // for bg dim
158
- + '-webkit-transition: var(--bg-transition) ; -moz-transition: var(--bg-transition) ;'
159
- + '-o-transition: var(--bg-transition) ; -ms-transition: var(--bg-transition) }'
155
+ + `.chatgpt-modal {
156
+ pointer-events: auto ; /* override any disabling from site modals (like guest login spam) */
157
+ position: fixed ; top: 0 ; left: 0 ; width: 100% ; height: 100% ; /* expand to full view-port */
158
+ display: flex ; justify-content: center ; align-items: center ; z-index: 9999 ; /* align */
159
+ transition: var(--bg-transition) ; /* for bg dim */
160
+ -webkit-transition: var(--bg-transition) ; -moz-transition: var(--bg-transition) ;
161
+ -o-transition: var(--bg-transition) ; -ms-transition: var(--bg-transition) }`
160
162
 
161
163
  // Alert styles
162
- + '.chatgpt-modal > div {'
163
- + 'position: absolute ;' // to be click-draggable
164
- + 'opacity: 0 ;' // to fade-in
165
- + `border: 1px solid ${ scheme == 'dark' ? 'white' : '#b5b5b5' };`
166
- + `color: ${ scheme == 'dark' ? 'white' : 'black' };`
167
- + `background-color: ${ scheme == 'dark' ? 'black' : 'white' };`
168
- + 'transform: translateX(-3px) translateY(7px) ;' // offset to move-in from
169
- + 'max-width: 75vw ; word-wrap: break-word ; border-radius: 15px ;'
170
- + 'padding: 20px ; margin: 12px 23px ;'
171
- + `--shadow: 0 30px 60px rgba(0,0,0,0.12) ; box-shadow: var(--shadow) ;
172
- -webkit-box-shadow: var(--shadow) ; -moz-box-shadow: var(--shadow) ;`
173
- + 'user-select: none ; -webkit-user-select: none ; -moz-user-select: none ; -o-user-select: none ;'
174
- + '-ms-user-select: none ;'
175
- + 'transition: var(--transition) ;' // for fade-in + move-in
176
- + '-webkit-transition: var(--transition) ; -moz-transition: var(--transition) ;'
177
- + '-o-transition: var(--transition) ; -ms-transition: var(--transition) }'
178
- + `.chatgpt-modal h2 { margin-bottom: 9px }
164
+ + `.chatgpt-modal > div {
165
+ position: absolute ; /* to be click-draggable */
166
+ opacity: 0 ; /* to fade-in */
167
+ font-family: -apple-system, system-ui, BlinkMacSystemFont, Segoe UI, Roboto,
168
+ Oxygen-Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif ;
169
+ padding: 20px ; margin: 12px 23px ; font-size: 20px ;
170
+ color: ${ scheme == 'dark' ? 'white' : 'black' };
171
+ background-color: ${ scheme == 'dark' ? 'black' : 'white' };
172
+ border: 1px solid ${ scheme == 'dark' ? 'white' : '#b5b5b5' };
173
+ transform: translateX(-3px) translateY(7px) ; /* offset to move-in from */
174
+ max-width: 75vw ; word-wrap: break-word ; border-radius: 15px ;
175
+ --shadow: 0 30px 60px rgba(0,0,0,0.12) ; box-shadow: var(--shadow) ;
176
+ -webkit-box-shadow: var(--shadow) ; -moz-box-shadow: var(--shadow) ;
177
+ user-select: none ; -webkit-user-select: none ; -moz-user-select: none ;
178
+ -o-user-select: none ; -ms-user-select: none ;
179
+ transition: var(--transition) ; /* for fade-in + move-in */
180
+ -webkit-transition: var(--transition) ; -moz-transition: var(--transition) ;
181
+ -o-transition: var(--transition) ; -ms-transition: var(--transition) }
182
+ .chatgpt-modal h2 { font-weight: bold ; font-size: 24px ; margin-bottom: 9px }
179
183
  .chatgpt-modal a { color: ${ scheme == 'dark' ? '#00cfff' : '#1e9ebb' }}
180
184
  .chatgpt-modal a:hover { text-decoration: underline }
181
185
  .chatgpt-modal.animated > div {
@@ -185,39 +189,44 @@ const chatgpt = {
185
189
  100% { opacity: 0 ; transform: scale(1.35) }}`
186
190
 
187
191
  // Button styles
188
- + '.modal-buttons { display: flex ; justify-content: flex-end ; margin: 20px -5px -3px 0 ;'
189
- + ( isMobile ? 'flex-direction: column-reverse' : '' ) + '}'
190
- + '.chatgpt-modal button {'
191
- + `margin-left: ${ isMobile ? 0 : 10}px ; padding: ${ isMobile ? 15 : 4}px 18px ; border-radius: 15px ;`
192
- + ( isMobile ? 'margin-top: 5px ; margin-bottom: 3px ;' : '')
193
- + `border: 1px solid ${ scheme == 'dark' ? 'white' : 'black' }}`
194
- + '.primary-modal-btn {'
195
- + `border: 1px solid ${ scheme == 'dark' ? 'white' : 'black' } ;`
196
- + `background: ${ scheme == 'dark' ? 'white' : 'black' } ;`
197
- + `color: ${ scheme == 'dark' ? 'black' : 'white' }}`
198
- + `.chatgpt-modal button:hover {
199
- color: #3d5d71 ; border-color: #6d9cb9 ;
200
- background-color: ${ scheme == 'dark' ? '#00cfff' : '#9cdaff' };
201
- --shadow: 2px 1px ${ scheme == 'dark' ? '54px #00cfff' : '30px #9cdaff' };
202
- box-shadow: var(--shadow) ; box-shadow: var(--shadow) ; box-shadow: var(--shadow) }`
203
- + '.modal-close-btn {'
204
- + 'cursor: pointer ; width: 29px ; height: 29px ; border-radius: 17px ;'
205
- + 'float: right ; position: relative ; right: -6px ; top: -5px }'
206
- + '.modal-close-btn svg { margin: 10px }' // center SVG for hover underlay
207
- + `.modal-close-btn:hover { background-color: #f2f2f2${ scheme == 'dark' ? '00' : '' }}`
192
+ + `.modal-buttons {
193
+ display: flex ; justify-content: flex-end ; margin: 20px -5px -3px 0 ;
194
+ ${ isMobile ? 'flex-direction: column-reverse' : '' }}
195
+ .chatgpt-modal button {
196
+ font-size: 14px ; text-transform: uppercase ;
197
+ margin-left: ${ isMobile ? 0 : 10 }px ; padding: ${ isMobile ? 15 : 8 }px 18px ;
198
+ ${ isMobile ? 'margin-top: 5px ; margin-bottom: 3px ;' : '' }
199
+ border-radius: 0 ; border: 1px solid ${ scheme == 'dark' ? 'white' : 'black' };
200
+ transition: var(--btn-transition) ;
201
+ -webkit-transition: var(--btn-transition) ; -moz-transition: var(--btn-transition) ;
202
+ -o-transition: var(--btn-transition) ; -ms-transition: var(--btn-transition) }
203
+ .chatgpt-modal button:hover {
204
+ transform: scale(1.055) ; color: black ;
205
+ background-color: #${ scheme == 'dark' ? '00cfff' : '9cdaff' };
206
+ box-shadow: var(--btn-shadow) ;
207
+ -webkit-box-shadow: var(--btn-shadow) ; -moz-box-shadow: var(--btn-shadow) }
208
+ .primary-modal-btn {
209
+ border: 1px solid ${ scheme == 'dark' ? 'white' : 'black' };
210
+ background: ${ scheme == 'dark' ? 'white' : 'black' };
211
+ color: ${ scheme == 'dark' ? 'black' : 'white' }}
212
+ .modal-close-btn {
213
+ cursor: pointer ; width: 29px ; height: 29px ; border-radius: 17px ;
214
+ float: right ; position: relative ; right: -6px ; top: -5px }
215
+ .modal-close-btn svg { margin: 10px } /* center SVG for hover underlay */
216
+ .modal-close-btn:hover { background-color: #f2f2f2${ scheme == 'dark' ? '00' : '' }}`
208
217
 
209
218
  // Checkbox styles
210
- + `.chatgpt-modal .checkbox-group { margin-top: 15px }
211
- .chatgpt-modal .checkbox-group label {
212
- font-size: .7rem ; margin: -.04rem 0 0px .3rem
213
- color: ${ scheme == 'dark' ? '#e1e1e1' : '#1e1e1e' }}
214
- .chatgpt-modal input[type=checkbox] { transform: scale(0.7) ;
219
+ + `.chatgpt-modal .checkbox-group { margin: 5px 0 -8px 5px }
220
+ .chatgpt-modal input[type=checkbox] {
221
+ cursor: pointer ; transform: scale(0.7) ; margin-right: 5px ;
215
222
  border: 1px solid ${ scheme == 'dark' ? 'white' : 'black' }}
216
223
  .chatgpt-modal input[type=checkbox]:checked {
217
- border: 1px solid ${ scheme == 'dark' ? 'white' : 'black' } ;
218
- background-color: black ; position: inherit }
224
+ background-color: black ; position: inherit ;
225
+ border: 1px solid ${ scheme == 'dark' ? 'white' : 'black' }}
219
226
  .chatgpt-modal input[type=checkbox]:focus {
220
- outline: none ; box-shadow: none ; -webkit-box-shadow: none ; -moz-box-shadow: none }`
227
+ outline: none ; box-shadow: none ; -webkit-box-shadow: none ; -moz-box-shadow: none }
228
+ .chatgpt-modal .checkbox-group label {
229
+ font-size: 14px ; color: ${ scheme == 'dark' ? '#e1e1e1' : '#1e1e1e' }}`
221
230
  )
222
231
  }
223
232
 
@@ -950,7 +959,12 @@ const chatgpt = {
950
959
  getLastResponse() { return chatgpt.getChatData('active', 'msg', 'chatgpt', 'latest'); },
951
960
 
952
961
  getNewChatButton() {
953
- return document.querySelector('button[data-testid*=new-chat-button], button:has([d^="M15.6729"])'); },
962
+ return document.querySelector(
963
+ 'button[data-testid*=new-chat-button],' // sidebar button (when logged in)
964
+ + 'button:has([d^="M3.06957"]),' // Cycle Arrows icon (Temp chat mode)
965
+ + 'button:has([d^="M15.6729"])' // Pencil icon (recorded chat mode)
966
+ )
967
+ },
954
968
 
955
969
  getNewChatLink() { return document.querySelector('nav a[href="/"]'); },
956
970
  getRegenerateButton() { return document.querySelector('button:has([d^="M3.06957"])'); },
@@ -1983,7 +1997,7 @@ for (const btnAction of cjsBtnActions) {
1983
1997
  };
1984
1998
  }
1985
1999
 
1986
- // Create alias functions
2000
+ // Create ALIAS functions
1987
2001
  const cjsFuncAliases = [
1988
2002
  ['actAs', 'actas', 'act', 'become', 'persona', 'premadePrompt', 'preMadePrompt', 'prePrompt', 'preprompt', 'roleplay', 'rolePlay', 'rp'],
1989
2003
  ['activateAutoRefresh', 'activateAutoRefresher', 'activateRefresher', 'activateSessionRefresher',
@@ -1996,14 +2010,13 @@ const cjsFuncAliases = [
1996
2010
  ['exportChat', 'chatExport', 'export'],
1997
2011
  ['getFooterDiv', 'getFooter'],
1998
2012
  ['getHeaderDiv', 'getHeader'],
1999
- ['getLastPrompt', 'getLastQuery', 'getMyLastMsg', 'getMyLastQuery'],
2013
+ ['getLastPrompt', 'getLastQuery', 'getMyLastMessage', 'getMyLastQuery'],
2000
2014
  ['getContinueButton', 'getContinueGeneratingButton'],
2001
2015
  ['getScrollToBottomButton', 'getScrollButton'],
2002
2016
  ['getStopButton', 'getStopGeneratingButton'],
2003
2017
  ['getTextarea', 'getTextArea', 'getChatbar', 'getChatBar', 'getChatbox', 'getChatBox'],
2004
2018
  ['isFullScreen', 'isFullscreen', 'isfullscreen'],
2005
- ['isLoaded', 'isloaded'],
2006
- ['logOut', 'logout', 'logOff', 'logoff', 'signOut', 'signout', 'signOff', 'signoff'],
2019
+ ['logout', 'logOut', 'logOff', 'signOff', 'signOut'],
2007
2020
  ['minify', 'codeMinify', 'minifyCode'],
2008
2021
  ['new', 'newChat', 'startNewChat'],
2009
2022
  ['obfuscate', 'codeObfuscate', 'obfuscateCode'],
@@ -2013,7 +2026,7 @@ const cjsFuncAliases = [
2013
2026
  ['refreshSession', 'sessionRefresh'],
2014
2027
  ['renderHTML', 'renderHtml', 'renderLinks', 'renderTags'],
2015
2028
  ['reviewCode', 'codeReview'],
2016
- ['send', 'sendChat', 'sendMsg'],
2029
+ ['send', 'sendChat', 'sendMessage'],
2017
2030
  ['sendInNewChat', 'sendNewChat'],
2018
2031
  ['sentiment', 'analyzeSentiment', 'sentimentAnalysis'],
2019
2032
  ['startNewChat', 'new', 'newChat'],
@@ -2024,7 +2037,7 @@ const cjsFuncAliases = [
2024
2037
  ['translate', 'translation', 'translator'],
2025
2038
  ['unminify', 'unminifyCode', 'codeUnminify'],
2026
2039
  ['writeCode', 'codeWrite']
2027
- ];
2040
+ ]
2028
2041
  const cjsFuncSynonyms = [
2029
2042
  ['account', 'acct'],
2030
2043
  ['activate', 'turnOn'],
@@ -2040,6 +2053,7 @@ const cjsFuncSynonyms = [
2040
2053
  ['execute', 'interpret', 'interpreter', 'run'],
2041
2054
  ['firefox', 'ff'],
2042
2055
  ['generating', 'generation'],
2056
+ ['message', 'msg'],
2043
2057
  ['minify', 'uglify'],
2044
2058
  ['refactor', 'rewrite'],
2045
2059
  ['regenerate', 'regen'],
@@ -2051,41 +2065,44 @@ const cjsFuncSynonyms = [
2051
2065
  ['typing', 'generating'],
2052
2066
  ['unminify', 'beautify', 'prettify', 'prettyPrint']
2053
2067
  ];
2054
- const camelCaser = (words) => {
2055
- return words.map((word, index) => index === 0 || word == 's' ? word : word.charAt(0).toUpperCase() + word.slice(1)).join(''); };
2056
- for (const prop in chatgpt) {
2057
-
2058
- // Create new function for each alias
2059
- for (const subAliases of cjsFuncAliases) {
2060
- if (subAliases.includes(prop)) {
2061
- if (subAliases.some(element => element.includes('.'))) {
2062
- const nestedFunction = subAliases.find(element => element.includes('.')).split('.')[1];
2063
- for (const nestAlias of subAliases) {
2064
- if (/^(\w+)/.exec(nestAlias)[1] !== prop) { // don't alias og function
2065
- chatgpt[nestAlias] = chatgpt[prop][nestedFunction]; // make new function, reference og one
2066
- }}} else { // alias direct functions
2067
- for (const dirAlias of subAliases) {
2068
- if (dirAlias !== prop) { // don't alias og function
2069
- chatgpt[dirAlias] = chatgpt[prop]; // make new function, reference og one
2070
- }}}
2071
- }}
2072
-
2073
- do { // create new function per synonym per word per function
2074
- var newFunctionsCreated = false;
2075
- for (const funcName in chatgpt) {
2076
- if (typeof chatgpt[funcName] == 'function') {
2077
- const funcWords = funcName.split(/(?=[A-Zs])/); // split function name into constituent words
2078
- for (const funcWord of funcWords) {
2079
- const synonymValues = [].concat(...cjsFuncSynonyms // flatten into single array w/ word's cjsFuncSynonyms
2068
+ (function createCJSaliasFuncs(obj = chatgpt) {
2069
+ for (const prop in obj) {
2070
+ if (!Object.prototype.hasOwnProperty.call(obj, prop)) continue // skip inherited props
2071
+ if (typeof obj[prop] == 'object') createCJSaliasFuncs(obj[prop]) // recurse thru objs to find deeper functions
2072
+ }
2073
+ let aliasFuncCreated
2074
+ do {
2075
+ aliasFuncCreated = false
2076
+ for (const prop in obj) {
2077
+ if (!Object.prototype.hasOwnProperty.call(obj, prop)) continue // skip inherited props
2078
+ if (typeof obj[prop] == 'function') {
2079
+ obj[prop.toLowerCase()] = obj[prop] // create lowercase variant
2080
+ cjsFuncAliases.forEach(aliasArr => { // create alias function per alias to use
2081
+ if (!aliasArr.includes(prop)) return
2082
+ aliasArr.forEach(alias => { if (!obj[alias]) {
2083
+ obj[alias] = obj[alias.toLowerCase()] = obj[prop] ; aliasFuncCreated = true }})
2084
+ })
2085
+ const funcWords = prop.split(/(?=[A-Z])/) // split function name into constituent words
2086
+ funcWords.forEach(funcWord => { // create alias function per function word per synonym
2087
+ const synonymsToUse = cjsFuncSynonyms
2080
2088
  .filter(arr => arr.includes(funcWord.toLowerCase())) // filter in relevant synonym sub-arrays
2081
- .map(arr => arr.filter(synonym => synonym !== funcWord.toLowerCase()))); // filter out matching word
2082
- for (const synonym of synonymValues) { // create function per synonym
2083
- const newFuncName = camelCaser(funcWords.map(word => (word == funcWord ? synonym : word)));
2084
- if (!chatgpt[newFuncName]) { // don't alias existing functions
2085
- chatgpt[newFuncName] = chatgpt[funcName]; // make new function, reference og one
2086
- newFunctionsCreated = true;
2087
- }}}}}} while (newFunctionsCreated); // loop over new functions to encompass all variations
2088
- }
2089
+ .flat().filter(synonym => synonym != funcWord.toLowerCase()) // filter out matching word
2090
+ synonymsToUse.forEach(synonym => { // create alias function per synonym to use
2091
+ const newFuncName = toCamelCase(funcWords.map(word => word == funcWord ? synonym : word))
2092
+ if (!obj[newFuncName]) {
2093
+ obj[newFuncName] = obj[newFuncName.toLowerCase()] = obj[prop] ; aliasFuncCreated = true }
2094
+ })
2095
+ })
2096
+ }
2097
+ }
2098
+ } while (aliasFuncCreated) // loop over new functions to encompass all variations
2099
+ })()
2100
+
2101
+
2102
+ // Define HELPER functions
2103
+
2104
+ function toCamelCase(words) {
2105
+ return words.map((word, idx) => idx == 0 ? word : word.charAt(0).toUpperCase() + word.slice(1)).join('') }
2089
2106
 
2090
2107
  // Prefix console logs w/ '🤖 chatgpt.js >> '
2091
2108
  const consolePrefix = '🤖 chatgpt.js >> ', ogError = console.error, ogInfo = console.info;