File tree Expand file tree Collapse file tree
static/extensions/DogeisCut Expand file tree Collapse file tree Original file line number Diff line number Diff line change 207207 this . regex . lastIndex = Cast . toNumber ( newLastIndex )
208208 }
209209
210- exec ( string ) {
211- // returns an array or null. need arrays ext
212- // also this array aparently has additional properties.. i love js
213- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec
214- let baseArray = this . regex . exec ( string )
210+ static convertEvilArrayIHateToObject ( baseArray ) {
215211 if ( baseArray ) {
216212 let newObj = Object . create ( null ) ;
217213 newObj . array = vm . jwArray . Type . toArray ( [ ...baseArray ] )
229225 }
230226 return vm . dogeiscutObject . Type . toObject ( newObj )
231227 }
232- return "" //returning an empty object felt weird
228+ return ""
229+ }
230+
231+ exec ( string ) {
232+ // returns an array or null. need arrays ext
233+ // also this array aparently has additional properties.. i love js
234+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/exec
235+ let baseArray = this . regex . exec ( string )
236+ return RegularExpressionType . convertEvilArrayIHateToObject ( baseArray )
233237 }
234238 test ( string ) {
235239 return Cast . toBoolean ( this . regex . test ( string ) )
553557 }
554558
555559 matchAll ( { REGEX , STRING } ) {
560+ // ok so turns out match all returns an iterator and we kinda sorta dont have an extension to handle that so im turning it into an array
556561 REGEX = RegularExpressionType . toRegularExpression ( REGEX )
557562 STRING = Cast . toString ( STRING )
558563 try {
559- return vm . jwArray . Type . toArray ( STRING . matchAll ( REGEX . regex ) )
564+ return vm . jwArray . Type . toArray ( [ ... STRING . matchAll ( REGEX . regex ) ] . map ( ( x ) => RegularExpressionType . convertEvilArrayIHateToObject ( x ) ) )
560565 } catch {
561566 return ""
562567 }
563- }
568+ }
564569
565570 sourceOf ( { REGEX } ) {
566571 REGEX = RegularExpressionType . toRegularExpression ( REGEX )
You can’t perform that action at this time.
0 commit comments