@jsep-plugin/regex
Advanced tools
Comparing version 1.0.1 to 1.0.2
'use strict'; | ||
const FSLASH_CODE = 47; // '/' | ||
const BSLASH_CODE = 92; // '\\' | ||
@@ -14,4 +15,5 @@ var index = { | ||
let inCharSet = false; | ||
while (this.index < this.expr.length) { | ||
if (this.char === '/') { | ||
if (this.code === FSLASH_CODE && !inCharSet) { | ||
const pattern = this.expr.slice(patternIndex, this.index); | ||
@@ -50,3 +52,9 @@ | ||
} | ||
this.index += 1; | ||
if (this.code === jsep.OBRACK_CODE) { | ||
inCharSet = true; | ||
} | ||
else if (inCharSet && this.code === jsep.CBRACK_CODE) { | ||
inCharSet = false; | ||
} | ||
this.index += this.code === BSLASH_CODE ? 2 : 1; | ||
} | ||
@@ -53,0 +61,0 @@ this.throwError('Unclosed Regex'); |
@@ -1,2 +0,2 @@ | ||
"use strict";var e={name:"regex",init(e){e.hooks.add("gobble-token",(function(t){if(47===this.code){const i=++this.index;for(;this.index<this.expr.length;){if("/"===this.char){const s=this.expr.slice(i,this.index);let r,o="";for(;++this.index<this.expr.length;){const e=this.code;if(!(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57))break;o+=this.char}try{r=new RegExp(s,o)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:r,raw:this.expr.slice(i-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.index+=1}this.throwError("Unclosed Regex")}}))}};module.exports=e; | ||
"use strict";var e={name:"regex",init(e){e.hooks.add("gobble-token",(function(t){if(47===this.code){const i=++this.index;let s=!1;for(;this.index<this.expr.length;){if(47===this.code&&!s){const s=this.expr.slice(i,this.index);let o,h="";for(;++this.index<this.expr.length;){const e=this.code;if(!(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57))break;h+=this.char}try{o=new RegExp(s,h)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:o,raw:this.expr.slice(i-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?s=!0:s&&this.code===e.CBRACK_CODE&&(s=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}}))}};module.exports=e; | ||
//# sourceMappingURL=index.cjs.min.js.map |
{ | ||
"type": "commonjs" | ||
} |
@@ -5,2 +5,3 @@ var index = (function () { | ||
const FSLASH_CODE = 47; // '/' | ||
const BSLASH_CODE = 92; // '\\' | ||
@@ -16,4 +17,5 @@ var index = { | ||
let inCharSet = false; | ||
while (this.index < this.expr.length) { | ||
if (this.char === '/') { | ||
if (this.code === FSLASH_CODE && !inCharSet) { | ||
const pattern = this.expr.slice(patternIndex, this.index); | ||
@@ -52,3 +54,9 @@ | ||
} | ||
this.index += 1; | ||
if (this.code === jsep.OBRACK_CODE) { | ||
inCharSet = true; | ||
} | ||
else if (inCharSet && this.code === jsep.CBRACK_CODE) { | ||
inCharSet = false; | ||
} | ||
this.index += this.code === BSLASH_CODE ? 2 : 1; | ||
} | ||
@@ -55,0 +63,0 @@ this.throwError('Unclosed Regex'); |
@@ -1,2 +0,2 @@ | ||
var index=function(){"use strict";return{name:"regex",init(e){e.hooks.add("gobble-token",(function(t){if(47===this.code){const i=++this.index;for(;this.index<this.expr.length;){if("/"===this.char){const n=this.expr.slice(i,this.index);let r,s="";for(;++this.index<this.expr.length;){const e=this.code;if(!(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57))break;s+=this.char}try{r=new RegExp(n,s)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:r,raw:this.expr.slice(i-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.index+=1}this.throwError("Unclosed Regex")}}))}}}(); | ||
var index=function(){"use strict";return{name:"regex",init(e){e.hooks.add("gobble-token",(function(t){if(47===this.code){const i=++this.index;let s=!1;for(;this.index<this.expr.length;){if(47===this.code&&!s){const s=this.expr.slice(i,this.index);let o,n="";for(;++this.index<this.expr.length;){const e=this.code;if(!(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57))break;n+=this.char}try{o=new RegExp(s,n)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:o,raw:this.expr.slice(i-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?s=!0:s&&this.code===e.CBRACK_CODE&&(s=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}}))}}}(); | ||
//# sourceMappingURL=index.iife.min.js.map |
const FSLASH_CODE = 47; // '/' | ||
const BSLASH_CODE = 92; // '\\' | ||
@@ -12,4 +13,5 @@ var index = { | ||
let inCharSet = false; | ||
while (this.index < this.expr.length) { | ||
if (this.char === '/') { | ||
if (this.code === FSLASH_CODE && !inCharSet) { | ||
const pattern = this.expr.slice(patternIndex, this.index); | ||
@@ -48,3 +50,9 @@ | ||
} | ||
this.index += 1; | ||
if (this.code === jsep.OBRACK_CODE) { | ||
inCharSet = true; | ||
} | ||
else if (inCharSet && this.code === jsep.CBRACK_CODE) { | ||
inCharSet = false; | ||
} | ||
this.index += this.code === BSLASH_CODE ? 2 : 1; | ||
} | ||
@@ -51,0 +59,0 @@ this.throwError('Unclosed Regex'); |
@@ -1,2 +0,2 @@ | ||
var e={name:"regex",init(e){e.hooks.add("gobble-token",(function(t){if(47===this.code){const i=++this.index;for(;this.index<this.expr.length;){if("/"===this.char){const s=this.expr.slice(i,this.index);let r,h="";for(;++this.index<this.expr.length;){const e=this.code;if(!(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57))break;h+=this.char}try{r=new RegExp(s,h)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:r,raw:this.expr.slice(i-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.index+=1}this.throwError("Unclosed Regex")}}))}};export{e as default}; | ||
var e={name:"regex",init(e){e.hooks.add("gobble-token",(function(t){if(47===this.code){const i=++this.index;let s=!1;for(;this.index<this.expr.length;){if(47===this.code&&!s){const s=this.expr.slice(i,this.index);let o,h="";for(;++this.index<this.expr.length;){const e=this.code;if(!(e>=97&&e<=122||e>=65&&e<=90||e>=48&&e<=57))break;h+=this.char}try{o=new RegExp(s,h)}catch(e){this.throwError(e.message)}return t.node={type:e.LITERAL,value:o,raw:this.expr.slice(i-1,this.index)},t.node=this.gobbleTokenProperty(t.node),t.node}this.code===e.OBRACK_CODE?s=!0:s&&this.code===e.CBRACK_CODE&&(s=!1),this.index+=92===this.code?2:1}this.throwError("Unclosed Regex")}}))}};export{e as default}; | ||
//# sourceMappingURL=index.min.js.map |
{ | ||
"name": "@jsep-plugin/regex", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Adds regex expression support", | ||
@@ -5,0 +5,0 @@ "author": "Shelly (https://github.com/6utt3rfly)", |
@@ -0,0 +0,0 @@ [npm]: https://img.shields.io/npm/v/@jsep-plugin/regex |
import * as jsep from 'jsep'; | ||
export const name: string; | ||
export function init(this: typeof jsep): void; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
25830
186