You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

glsl-transpiler

Package Overview
Dependencies
Maintainers
12
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

glsl-transpiler - npm Package Compare versions

Comparing version

to
1.7.1

23

lib/operators.js

@@ -47,3 +47,22 @@ 'use strict'

/**
* Check if expression is protected by parentheses
*/
function isBraced (exp) {
if (/\s/.test(exp)) {
// a + b
if (exp[0] !== '(') return false;
var level = 1;
var len = exp.length;
for (let i = 1; i < len - 1; i++) {
if (exp[i] === '(') level++;
else if (exp[i] === ')') level--;
// (a + b) * c + d
if (level === 0) return false;
}
}
return true;
}
/**

@@ -291,3 +310,3 @@ * Return rendered operation

if (operator != '+' && operator != '-') {
if (/\s/.test(left) && left[0] != '(' && left[left.length - 1] != ')') opResult += '(' + left + ')'
if (!isBraced(left)) opResult += '(' + left + ')'
else opResult += left

@@ -300,3 +319,3 @@ }

if (operator != '+' && operator != '-') {
if (/\s/.test(right) && right[0] != '(' && right[right.length - 1] != ')') opResult += '(' + right + ')'
if (!isBraced(right)) opResult += '(' + right + ')'
else opResult += right

@@ -303,0 +322,0 @@ }

2

package.json
{
"name": "glsl-transpiler",
"version": "1.7.0",
"version": "1.7.1",
"description": "Transpile GLSL to JS",

@@ -5,0 +5,0 @@ "main": "index.js",