@jsep-plugin/assignment
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -30,5 +30,6 @@ 'use strict'; | ||
// See operator precedence https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence | ||
assignmentOperators.forEach(op => jsep.addBinaryOp(op, 11)); | ||
// We need lower priority than || and && which start at 1 | ||
assignmentOperators.forEach(op => jsep.addBinaryOp(op, 0.9)); | ||
jsep.hooks.add('gobble-expression', function gobbleUpdatePrefix(env) { | ||
jsep.hooks.add('gobble-token', function gobbleUpdatePrefix(env) { | ||
const code = this.code; | ||
@@ -40,3 +41,3 @@ if (updateOperators.some(c => c === code && c === this.expr.charCodeAt(this.index + 1))) { | ||
operator: code === PLUS_CODE ? '++' : '--', | ||
argument: this.gobbleExpression(), | ||
argument: this.gobbleTokenProperty(this.gobbleIdentifier()), | ||
prefix: true, | ||
@@ -43,0 +44,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
"use strict";var e={name:"assignment",init(e){const o=new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|="]),t=[43,45],n=[e.IDENTIFIER,e.MEMBER_EXP];o.forEach((o=>e.addBinaryOp(o,11))),e.hooks.add("gobble-expression",(function(e){const o=this.code;t.some((e=>e===o&&e===this.expr.charCodeAt(this.index+1)))&&(this.index+=2,e.node={type:"UpdateExpression",operator:43===o?"++":"--",argument:this.gobbleExpression(),prefix:!0},e.node.argument&&n.includes(e.node.argument.type)||this.throwError(`Unexpected ${e.node.operator}`))})),e.hooks.add("after-token",(function(e){if(e.node){const o=this.code;t.some((e=>e===o&&e===this.expr.charCodeAt(this.index+1)))&&(n.includes(e.node.type)||this.throwError(`Unexpected ${e.node.operator}`),this.index+=2,e.node={type:"UpdateExpression",operator:43===o?"++":"--",argument:e.node,prefix:!1})}})),e.hooks.add("after-expression",(function(e){e.node&&o.has(e.node.operator)&&(e.node.type="AssignmentExpression")}))}};module.exports=e; | ||
"use strict";var e={name:"assignment",init(e){const o=new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|="]),t=[43,45],n=[e.IDENTIFIER,e.MEMBER_EXP];o.forEach((o=>e.addBinaryOp(o,.9))),e.hooks.add("gobble-token",(function(e){const o=this.code;t.some((e=>e===o&&e===this.expr.charCodeAt(this.index+1)))&&(this.index+=2,e.node={type:"UpdateExpression",operator:43===o?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},e.node.argument&&n.includes(e.node.argument.type)||this.throwError(`Unexpected ${e.node.operator}`))})),e.hooks.add("after-token",(function(e){if(e.node){const o=this.code;t.some((e=>e===o&&e===this.expr.charCodeAt(this.index+1)))&&(n.includes(e.node.type)||this.throwError(`Unexpected ${e.node.operator}`),this.index+=2,e.node={type:"UpdateExpression",operator:43===o?"++":"--",argument:e.node,prefix:!1})}})),e.hooks.add("after-expression",(function(e){e.node&&o.has(e.node.operator)&&(e.node.type="AssignmentExpression")}))}};module.exports=e; | ||
//# sourceMappingURL=index.cjs.min.js.map |
@@ -31,5 +31,6 @@ var index = (function () { | ||
// See operator precedence https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence | ||
assignmentOperators.forEach(op => jsep.addBinaryOp(op, 11)); | ||
// We need lower priority than || and && which start at 1 | ||
assignmentOperators.forEach(op => jsep.addBinaryOp(op, 0.9)); | ||
jsep.hooks.add('gobble-expression', function gobbleUpdatePrefix(env) { | ||
jsep.hooks.add('gobble-token', function gobbleUpdatePrefix(env) { | ||
const code = this.code; | ||
@@ -41,3 +42,3 @@ if (updateOperators.some(c => c === code && c === this.expr.charCodeAt(this.index + 1))) { | ||
operator: code === PLUS_CODE ? '++' : '--', | ||
argument: this.gobbleExpression(), | ||
argument: this.gobbleTokenProperty(this.gobbleIdentifier()), | ||
prefix: true, | ||
@@ -44,0 +45,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
var index=function(){"use strict";return{name:"assignment",init(e){const o=new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|="]),n=[43,45],t=[e.IDENTIFIER,e.MEMBER_EXP];o.forEach((o=>e.addBinaryOp(o,11))),e.hooks.add("gobble-expression",(function(e){const o=this.code;n.some((e=>e===o&&e===this.expr.charCodeAt(this.index+1)))&&(this.index+=2,e.node={type:"UpdateExpression",operator:43===o?"++":"--",argument:this.gobbleExpression(),prefix:!0},e.node.argument&&t.includes(e.node.argument.type)||this.throwError(`Unexpected ${e.node.operator}`))})),e.hooks.add("after-token",(function(e){if(e.node){const o=this.code;n.some((e=>e===o&&e===this.expr.charCodeAt(this.index+1)))&&(t.includes(e.node.type)||this.throwError(`Unexpected ${e.node.operator}`),this.index+=2,e.node={type:"UpdateExpression",operator:43===o?"++":"--",argument:e.node,prefix:!1})}})),e.hooks.add("after-expression",(function(e){e.node&&o.has(e.node.operator)&&(e.node.type="AssignmentExpression")}))}}}(); | ||
var index=function(){"use strict";return{name:"assignment",init(e){const o=new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|="]),t=[43,45],n=[e.IDENTIFIER,e.MEMBER_EXP];o.forEach((o=>e.addBinaryOp(o,.9))),e.hooks.add("gobble-token",(function(e){const o=this.code;t.some((e=>e===o&&e===this.expr.charCodeAt(this.index+1)))&&(this.index+=2,e.node={type:"UpdateExpression",operator:43===o?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},e.node.argument&&n.includes(e.node.argument.type)||this.throwError(`Unexpected ${e.node.operator}`))})),e.hooks.add("after-token",(function(e){if(e.node){const o=this.code;t.some((e=>e===o&&e===this.expr.charCodeAt(this.index+1)))&&(n.includes(e.node.type)||this.throwError(`Unexpected ${e.node.operator}`),this.index+=2,e.node={type:"UpdateExpression",operator:43===o?"++":"--",argument:e.node,prefix:!1})}})),e.hooks.add("after-expression",(function(e){e.node&&o.has(e.node.operator)&&(e.node.type="AssignmentExpression")}))}}}(); | ||
//# sourceMappingURL=index.iife.min.js.map |
@@ -28,5 +28,6 @@ const PLUS_CODE = 43; // + | ||
// See operator precedence https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence | ||
assignmentOperators.forEach(op => jsep.addBinaryOp(op, 11)); | ||
// We need lower priority than || and && which start at 1 | ||
assignmentOperators.forEach(op => jsep.addBinaryOp(op, 0.9)); | ||
jsep.hooks.add('gobble-expression', function gobbleUpdatePrefix(env) { | ||
jsep.hooks.add('gobble-token', function gobbleUpdatePrefix(env) { | ||
const code = this.code; | ||
@@ -38,3 +39,3 @@ if (updateOperators.some(c => c === code && c === this.expr.charCodeAt(this.index + 1))) { | ||
operator: code === PLUS_CODE ? '++' : '--', | ||
argument: this.gobbleExpression(), | ||
argument: this.gobbleTokenProperty(this.gobbleIdentifier()), | ||
prefix: true, | ||
@@ -41,0 +42,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
var e={name:"assignment",init(e){const o=new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|="]),n=[43,45],t=[e.IDENTIFIER,e.MEMBER_EXP];o.forEach((o=>e.addBinaryOp(o,11))),e.hooks.add("gobble-expression",(function(e){const o=this.code;n.some((e=>e===o&&e===this.expr.charCodeAt(this.index+1)))&&(this.index+=2,e.node={type:"UpdateExpression",operator:43===o?"++":"--",argument:this.gobbleExpression(),prefix:!0},e.node.argument&&t.includes(e.node.argument.type)||this.throwError(`Unexpected ${e.node.operator}`))})),e.hooks.add("after-token",(function(e){if(e.node){const o=this.code;n.some((e=>e===o&&e===this.expr.charCodeAt(this.index+1)))&&(t.includes(e.node.type)||this.throwError(`Unexpected ${e.node.operator}`),this.index+=2,e.node={type:"UpdateExpression",operator:43===o?"++":"--",argument:e.node,prefix:!1})}})),e.hooks.add("after-expression",(function(e){e.node&&o.has(e.node.operator)&&(e.node.type="AssignmentExpression")}))}};export{e as default}; | ||
var e={name:"assignment",init(e){const o=new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|="]),t=[43,45],n=[e.IDENTIFIER,e.MEMBER_EXP];o.forEach((o=>e.addBinaryOp(o,.9))),e.hooks.add("gobble-token",(function(e){const o=this.code;t.some((e=>e===o&&e===this.expr.charCodeAt(this.index+1)))&&(this.index+=2,e.node={type:"UpdateExpression",operator:43===o?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},e.node.argument&&n.includes(e.node.argument.type)||this.throwError(`Unexpected ${e.node.operator}`))})),e.hooks.add("after-token",(function(e){if(e.node){const o=this.code;t.some((e=>e===o&&e===this.expr.charCodeAt(this.index+1)))&&(n.includes(e.node.type)||this.throwError(`Unexpected ${e.node.operator}`),this.index+=2,e.node={type:"UpdateExpression",operator:43===o?"++":"--",argument:e.node,prefix:!1})}})),e.hooks.add("after-expression",(function(e){e.node&&o.has(e.node.operator)&&(e.node.type="AssignmentExpression")}))}};export{e as default}; | ||
//# sourceMappingURL=index.min.js.map |
{ | ||
"name": "@jsep-plugin/assignment", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Adds assignment expression support", | ||
@@ -5,0 +5,0 @@ "author": "Shelly (https://github.com/6utt3rfly)", |
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
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
33646
15
247