Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tippex

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tippex - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

4

CHANGELOG.md
# Tippex changelog
## 2.3.0
* JSX support ([#14](https://github.com/Rich-Harris/tippex/pull/14))
## 2.2.0

@@ -4,0 +8,0 @@

@@ -22,2 +22,3 @@ function getLocation ( source, charIndex ) {

var ambiguous = /(\}|\)|\+\+|--)\s*$/;
var beforeJsx = /^$|[=:;,\(\{\}\[|&+]\s*$/;

@@ -29,2 +30,3 @@ function find ( str ) {

var pfixOp = false;
var jsxTagDepth = 0;
var stack = [];

@@ -48,3 +50,3 @@

if ( char === '"' || char === "'" ) return start = i, quote = char, string;
if ( char === '"' || char === "'" ) return start = i, quote = char, stack.push( base ), string;
if ( char === '`' ) return start = i, templateString;

@@ -59,2 +61,8 @@

if ( char === '<' ) {
var substr$1 = str.substr( 0, i );
substr$1 = _erase( substr$1, found ).trim();
if ( beforeJsx.test( substr$1 ) ) return stack.push( base ), jsxTagStart;
}
return base;

@@ -102,3 +110,3 @@ }

return base;
return stack.pop();
}

@@ -144,2 +152,39 @@

// JSX is an XML-like extension to ECMAScript
// https://facebook.github.io/jsx/
function jsxTagStart ( char ) {
if ( char === '/' ) return jsxTagDepth--, jsxTag;
return jsxTagDepth++, jsxTag;
}
function jsxTag ( char, i ) {
if ( char === '"' || char === "'" ) return start = i, quote = char, stack.push( jsxTag ), string;
if ( char === '{' ) return stack.push( jsxTag ), base;
if ( char === '>' ) {
if ( jsxTagDepth <= 0 ) return base;
return jsx;
}
if ( char === '/' ) return jsxTagSelfClosing;
return jsxTag;
}
function jsxTagSelfClosing ( char ) {
if ( char === '>' ) {
jsxTagDepth--;
if ( jsxTagDepth <= 0 ) return base;
return jsx;
}
return jsxTag;
}
function jsx ( char ) {
if ( char === '{' ) return stack.push( jsx ), base;
if ( char === '<' ) return jsxTagStart;
return jsx;
}
function lineComment ( char, end ) {

@@ -185,3 +230,3 @@ if ( char === '\n' ) {

var snippet = "" + beforeLine + afterLine + "\n" + (Array( beforeLine.length + 1 ).join( ' ' )) + "^";
var snippet = "" + beforeLine + "" + afterLine + "\n" + (Array( beforeLine.length + 1 ).join( ' ' )) + "^";

@@ -333,2 +378,2 @@ throw new Error( ("Unexpected character (" + line + ":" + column + "). If this is valid JavaScript, it's probably a bug in tippex. Please raise an issue at https://github.com/Rich-Harris/tippex/issues – thanks!\n\n" + snippet) );

export { find, erase, match, replace };
//# sourceMappingURL=tippex.es6.js.map
//# sourceMappingURL=tippex.es6.js.map

513

dist/tippex.umd.js

@@ -5,334 +5,381 @@ (function (global, factory) {

(factory((global.tippex = global.tippex || {})));
}(this, function (exports) { 'use strict';
}(this, (function (exports) { 'use strict';
function getLocation ( source, charIndex ) {
var lines = source.split( '\n' );
var len = lines.length;
function getLocation ( source, charIndex ) {
var lines = source.split( '\n' );
var len = lines.length;
for ( var i = 0, lineStart = 0; i < len; i += 1 ) {
var line = lines[i];
var lineEnd = lineStart + line.length + 1; // +1 for newline
for ( var i = 0, lineStart = 0; i < len; i += 1 ) {
var line = lines[i];
var lineEnd = lineStart + line.length + 1; // +1 for newline
if ( lineEnd > charIndex ) {
return { line: i + 1, column: charIndex - lineStart };
}
lineStart = lineEnd;
if ( lineEnd > charIndex ) {
return { line: i + 1, column: charIndex - lineStart };
}
throw new Error( ("Could not determine location of character " + charIndex) );
lineStart = lineEnd;
}
var keywords = /(case|default|delete|do|else|in|instanceof|new|return|throw|typeof|void)\s*$/;
var punctuators = /(^|\{|\(|\[\.|;|,|<|>|<=|>=|==|!=|===|!==|\+|-|\*\%|<<|>>|>>>|&|\||\^|!|~|&&|\|\||\?|:|=|\+=|-=|\*=|%=|<<=|>>=|>>>=|&=|\|=|\^=|\/=|\/)\s*$/;
var ambiguous = /(\}|\)|\+\+|--)\s*$/;
throw new Error( ("Could not determine location of character " + charIndex) );
}
function find ( str ) {
var quote;
var escapedFrom;
var regexEnabled = true;
var pfixOp = false;
var stack = [];
var keywords = /(case|default|delete|do|else|in|instanceof|new|return|throw|typeof|void)\s*$/;
var punctuators = /(^|\{|\(|\[\.|;|,|<|>|<=|>=|==|!=|===|!==|\+|-|\*\%|<<|>>|>>>|&|\||\^|!|~|&&|\|\||\?|:|=|\+=|-=|\*=|%=|<<=|>>=|>>>=|&=|\|=|\^=|\/=|\/)\s*$/;
var ambiguous = /(\}|\)|\+\+|--)\s*$/;
var beforeJsx = /^$|[=:;,\(\{\}\[|&+]\s*$/;
var start;
var found = [];
var state = base;
function find ( str ) {
var quote;
var escapedFrom;
var regexEnabled = true;
var pfixOp = false;
var jsxTagDepth = 0;
var stack = [];
function base ( char, i ) {
if ( char === '/' ) {
// could be start of regex literal OR division punctuator. Solution via
// http://stackoverflow.com/questions/5519596/when-parsing-javascript-what-determines-the-meaning-of-a-slash/27120110#27120110
var substr = str.substr( 0, i );
if ( keywords.test( substr ) || punctuators.test( substr ) ) regexEnabled = true;
else if ( ambiguous.test( substr ) && !tokenClosesExpression( substr, found ) ) regexEnabled = true; // TODO save this determination for when it's necessary?
else regexEnabled = false;
var start;
var found = [];
var state = base;
return start = i, slash;
}
function base ( char, i ) {
if ( char === '/' ) {
// could be start of regex literal OR division punctuator. Solution via
// http://stackoverflow.com/questions/5519596/when-parsing-javascript-what-determines-the-meaning-of-a-slash/27120110#27120110
var substr = str.substr( 0, i );
if ( keywords.test( substr ) || punctuators.test( substr ) ) regexEnabled = true;
else if ( ambiguous.test( substr ) && !tokenClosesExpression( substr, found ) ) regexEnabled = true; // TODO save this determination for when it's necessary?
else regexEnabled = false;
if ( char === '"' || char === "'" ) return start = i, quote = char, string;
if ( char === '`' ) return start = i, templateString;
return start = i, slash;
}
if ( char === '{' ) return stack.push( base ), base;
if ( char === '}' ) return start = i, stack.pop();
if ( char === '"' || char === "'" ) return start = i, quote = char, stack.push( base ), string;
if ( char === '`' ) return start = i, templateString;
if ( !( pfixOp && /\W/.test( char ) ) ) {
pfixOp = ( char === '+' && str[ i - 1 ] === '+' ) || ( char === '-' && str[ i - 1 ] === '-' );
}
if ( char === '{' ) return stack.push( base ), base;
if ( char === '}' ) return start = i, stack.pop();
return base;
if ( !( pfixOp && /\W/.test( char ) ) ) {
pfixOp = ( char === '+' && str[ i - 1 ] === '+' ) || ( char === '-' && str[ i - 1 ] === '-' );
}
function slash ( char ) {
if ( char === '/' ) return lineComment;
if ( char === '*' ) return blockComment;
if ( char === '[' ) return regexEnabled ? regexCharacter : base;
return regexEnabled && !pfixOp ? regex : base;
if ( char === '<' ) {
var substr$1 = str.substr( 0, i );
substr$1 = _erase( substr$1, found ).trim();
if ( beforeJsx.test( substr$1 ) ) return stack.push( base ), jsxTagStart;
}
function regex ( char, i ) {
if ( char === '[' ) return regexCharacter;
if ( char === '\\' ) return escapedFrom = regex, escaped;
return base;
}
if ( char === '/' ) {
var end = i + 1;
var outer = str.slice( start, end );
var inner = outer.slice( 1, -1 );
function slash ( char ) {
if ( char === '/' ) return lineComment;
if ( char === '*' ) return blockComment;
if ( char === '[' ) return regexEnabled ? regexCharacter : base;
return regexEnabled && !pfixOp ? regex : base;
}
found.push({ start: start, end: end, inner: inner, outer: outer, type: 'regex' });
function regex ( char, i ) {
if ( char === '[' ) return regexCharacter;
if ( char === '\\' ) return escapedFrom = regex, escaped;
return base;
}
if ( char === '/' ) {
var end = i + 1;
var outer = str.slice( start, end );
var inner = outer.slice( 1, -1 );
return regex;
}
found.push({ start: start, end: end, inner: inner, outer: outer, type: 'regex' });
function regexCharacter ( char ) {
if ( char === ']' ) return regex;
if ( char === '\\' ) return escapedFrom = regexCharacter, escaped;
return regexCharacter;
return base;
}
function string ( char, i ) {
if ( char === '\\' ) return escapedFrom = string, escaped;
if ( char === quote ) {
var end = i + 1;
var outer = str.slice( start, end );
var inner = outer.slice( 1, -1 );
return regex;
}
found.push({ start: start, end: end, inner: inner, outer: outer, type: 'string' });
function regexCharacter ( char ) {
if ( char === ']' ) return regex;
if ( char === '\\' ) return escapedFrom = regexCharacter, escaped;
return regexCharacter;
}
return base;
}
function string ( char, i ) {
if ( char === '\\' ) return escapedFrom = string, escaped;
if ( char === quote ) {
var end = i + 1;
var outer = str.slice( start, end );
var inner = outer.slice( 1, -1 );
return string;
}
found.push({ start: start, end: end, inner: inner, outer: outer, type: 'string' });
function escaped () {
return escapedFrom;
return stack.pop();
}
function templateString ( char, i ) {
if ( char === '$' ) return templateStringDollar;
if ( char === '\\' ) return escapedFrom = templateString, escaped;
return string;
}
if ( char === '`' ) {
var end = i + 1;
var outer = str.slice( start, end );
var inner = outer.slice( 1, -1 );
function escaped () {
return escapedFrom;
}
found.push({ start: start, end: end, inner: inner, outer: outer, type: 'templateEnd' });
function templateString ( char, i ) {
if ( char === '$' ) return templateStringDollar;
if ( char === '\\' ) return escapedFrom = templateString, escaped;
return base;
}
if ( char === '`' ) {
var end = i + 1;
var outer = str.slice( start, end );
var inner = outer.slice( 1, -1 );
return templateString;
found.push({ start: start, end: end, inner: inner, outer: outer, type: 'templateEnd' });
return base;
}
function templateStringDollar ( char, i ) {
if ( char === '{' ) {
var end = i + 1;
var outer = str.slice( start, end );
var inner = outer.slice( 1, -2 );
return templateString;
}
found.push({ start: start, end: end, inner: inner, outer: outer, type: 'templateChunk' });
function templateStringDollar ( char, i ) {
if ( char === '{' ) {
var end = i + 1;
var outer = str.slice( start, end );
var inner = outer.slice( 1, -2 );
stack.push( templateString );
return base;
}
return templateString( char, i );
found.push({ start: start, end: end, inner: inner, outer: outer, type: 'templateChunk' });
stack.push( templateString );
return base;
}
return templateString( char, i );
}
function lineComment ( char, end ) {
if ( char === '\n' ) {
var outer = str.slice( start, end );
var inner = outer.slice( 2 );
// JSX is an XML-like extension to ECMAScript
// https://facebook.github.io/jsx/
found.push({ start: start, end: end, inner: inner, outer: outer, type: 'line' });
function jsxTagStart ( char ) {
if ( char === '/' ) return jsxTagDepth--, jsxTag;
return jsxTagDepth++, jsxTag;
}
return base;
}
function jsxTag ( char, i ) {
if ( char === '"' || char === "'" ) return start = i, quote = char, stack.push( jsxTag ), string;
if ( char === '{' ) return stack.push( jsxTag ), base;
if ( char === '>' ) {
if ( jsxTagDepth <= 0 ) return base;
return jsx;
}
if ( char === '/' ) return jsxTagSelfClosing;
return lineComment;
return jsxTag;
}
function jsxTagSelfClosing ( char ) {
if ( char === '>' ) {
jsxTagDepth--;
if ( jsxTagDepth <= 0 ) return base;
return jsx;
}
function blockComment ( char ) {
if ( char === '*' ) return blockCommentEnding;
return blockComment;
return jsxTag;
}
function jsx ( char ) {
if ( char === '{' ) return stack.push( jsx ), base;
if ( char === '<' ) return jsxTagStart;
return jsx;
}
function lineComment ( char, end ) {
if ( char === '\n' ) {
var outer = str.slice( start, end );
var inner = outer.slice( 2 );
found.push({ start: start, end: end, inner: inner, outer: outer, type: 'line' });
return base;
}
function blockCommentEnding ( char, i ) {
if ( char === '/' ) {
var end = i + 1;
var outer = str.slice( start, end );
var inner = outer.slice( 2, -2 );
return lineComment;
}
found.push({ start: start, end: end, inner: inner, outer: outer, type: 'block' });
function blockComment ( char ) {
if ( char === '*' ) return blockCommentEnding;
return blockComment;
}
return base;
}
function blockCommentEnding ( char, i ) {
if ( char === '/' ) {
var end = i + 1;
var outer = str.slice( start, end );
var inner = outer.slice( 2, -2 );
return blockComment( char );
found.push({ start: start, end: end, inner: inner, outer: outer, type: 'block' });
return base;
}
for ( var i = 0; i < str.length; i += 1 ) {
if ( !state ) {
var ref = getLocation( str, i ), line = ref.line, column = ref.column;
var before = str.slice( 0, i );
var beforeLine = /(^|\n).+$/.exec( before )[0];
var after = str.slice( i );
var afterLine = /.+(\n|$)/.exec( after )[0];
return blockComment( char );
}
var snippet = "" + beforeLine + afterLine + "\n" + (Array( beforeLine.length + 1 ).join( ' ' )) + "^";
for ( var i = 0; i < str.length; i += 1 ) {
if ( !state ) {
var ref = getLocation( str, i ), line = ref.line, column = ref.column;
var before = str.slice( 0, i );
var beforeLine = /(^|\n).+$/.exec( before )[0];
var after = str.slice( i );
var afterLine = /.+(\n|$)/.exec( after )[0];
throw new Error( ("Unexpected character (" + line + ":" + column + "). If this is valid JavaScript, it's probably a bug in tippex. Please raise an issue at https://github.com/Rich-Harris/tippex/issues – thanks!\n\n" + snippet) );
}
var snippet = "" + beforeLine + "" + afterLine + "\n" + (Array( beforeLine.length + 1 ).join( ' ' )) + "^";
state = state( str[i], i );
throw new Error( ("Unexpected character (" + line + ":" + column + "). If this is valid JavaScript, it's probably a bug in tippex. Please raise an issue at https://github.com/Rich-Harris/tippex/issues – thanks!\n\n" + snippet) );
}
return found;
state = state( str[i], i );
}
function tokenClosesExpression ( substr, found ) {
substr = _erase( substr, found );
return found;
}
var token = ambiguous.exec( substr );
if ( token ) token = token[1];
function tokenClosesExpression ( substr, found ) {
substr = _erase( substr, found );
if ( token === ')' ) {
var count = 0;
var i = substr.length;
while ( i-- ) {
if ( substr[i] === ')' ) {
count += 1;
}
var token = ambiguous.exec( substr );
if ( token ) token = token[1];
if ( substr[i] === '(' ) {
count -= 1;
if ( count === 0 ) {
i -= 1;
break;
}
if ( token === ')' ) {
var count = 0;
var i = substr.length;
while ( i-- ) {
if ( substr[i] === ')' ) {
count += 1;
}
if ( substr[i] === '(' ) {
count -= 1;
if ( count === 0 ) {
i -= 1;
break;
}
}
// if parenthesized expression is immediately preceded by `if`/`while`, it's not closing an expression
while ( /\s/.test( substr[i - 1] ) ) i -= 1;
if ( substr.slice( i - 2, i ) === 'if' || substr.slice( i - 5, i ) === 'while' ) return false;
}
// TODO handle }, ++ and -- tokens immediately followed by / character
return true;
// if parenthesized expression is immediately preceded by `if`/`while`, it's not closing an expression
while ( /\s/.test( substr[i - 1] ) ) i -= 1;
if ( substr.slice( i - 2, i ) === 'if' || substr.slice( i - 5, i ) === 'while' ) return false;
}
function spaces ( count ) {
var spaces = '';
while ( count-- ) spaces += ' ';
return spaces;
}
// TODO handle }, ++ and -- tokens immediately followed by / character
return true;
}
var erasers = {
string: function ( chunk ) { return chunk.outer[0] + spaces( chunk.inner.length ) + chunk.outer[0]; },
line: function ( chunk ) { return spaces( chunk.outer.length ); },
block: function ( chunk ) { return chunk.outer.split( '\n' ).map( function ( line ) { return spaces( line.length ); } ).join( '\n' ); },
regex: function ( chunk ) { return '/' + spaces( chunk.inner.length ) + '/'; },
templateChunk: function ( chunk ) { return chunk.outer[0] + spaces( chunk.inner.length ) + '${'; },
templateEnd: function ( chunk ) { return chunk.outer[0] + spaces( chunk.inner.length ) + '`'; }
};
function spaces ( count ) {
var spaces = '';
while ( count-- ) spaces += ' ';
return spaces;
}
function erase ( str ) {
var found = find( str );
return _erase( str, found );
}
var erasers = {
string: function ( chunk ) { return chunk.outer[0] + spaces( chunk.inner.length ) + chunk.outer[0]; },
line: function ( chunk ) { return spaces( chunk.outer.length ); },
block: function ( chunk ) { return chunk.outer.split( '\n' ).map( function ( line ) { return spaces( line.length ); } ).join( '\n' ); },
regex: function ( chunk ) { return '/' + spaces( chunk.inner.length ) + '/'; },
templateChunk: function ( chunk ) { return chunk.outer[0] + spaces( chunk.inner.length ) + '${'; },
templateEnd: function ( chunk ) { return chunk.outer[0] + spaces( chunk.inner.length ) + '`'; }
};
function _erase ( str, found ) {
var erased = '';
var charIndex = 0;
function erase ( str ) {
var found = find( str );
return _erase( str, found );
}
for ( var i = 0; i < found.length; i += 1 ) {
var chunk = found[i];
erased += str.slice( charIndex, chunk.start );
erased += erasers[ chunk.type ]( chunk );
function _erase ( str, found ) {
var erased = '';
var charIndex = 0;
charIndex = chunk.end;
}
for ( var i = 0; i < found.length; i += 1 ) {
var chunk = found[i];
erased += str.slice( charIndex, chunk.start );
erased += erasers[ chunk.type ]( chunk );
erased += str.slice( charIndex );
return erased;
charIndex = chunk.end;
}
function makeGlobalRegExp ( original ) {
var flags = 'g';
erased += str.slice( charIndex );
return erased;
}
if ( original.multiline ) flags += 'm';
if ( original.ignoreCase ) flags += 'i';
if ( original.sticky ) flags += 'y';
if ( original.unicode ) flags += 'u';
function makeGlobalRegExp ( original ) {
var flags = 'g';
return new RegExp( original.source, flags );
}
if ( original.multiline ) flags += 'm';
if ( original.ignoreCase ) flags += 'i';
if ( original.sticky ) flags += 'y';
if ( original.unicode ) flags += 'u';
function match ( str, pattern, callback ) {
var g = pattern.global;
if ( !g ) pattern = makeGlobalRegExp( pattern );
return new RegExp( original.source, flags );
}
var found = find( str );
function match ( str, pattern, callback ) {
var g = pattern.global;
if ( !g ) pattern = makeGlobalRegExp( pattern );
var match;
var chunkIndex = 0;
var found = find( str );
while ( match = pattern.exec( str ) ) {
var chunk;
var match;
var chunkIndex = 0;
do {
chunk = found[ chunkIndex ];
while ( match = pattern.exec( str ) ) {
var chunk;
if ( chunk && chunk.end < match.index ) {
chunkIndex += 1;
} else {
break;
}
} while ( chunk );
do {
chunk = found[ chunkIndex ];
if ( !chunk || chunk.start > match.index ) {
var args = [].slice.call( match ).concat( match.index, str );
callback.apply( null, args );
if ( !g ) break;
if ( chunk && chunk.end < match.index ) {
chunkIndex += 1;
} else {
break;
}
} while ( chunk );
if ( !chunk || chunk.start > match.index ) {
var args = [].slice.call( match ).concat( match.index, str );
callback.apply( null, args );
if ( !g ) break;
}
}
}
function replace ( str, pattern, callback ) {
var replacements = [];
function replace ( str, pattern, callback ) {
var replacements = [];
match( str, pattern, function ( match ) {
var start = arguments[ arguments.length - 2 ];
var end = start + match.length;
var content = callback.apply( null, arguments );
match( str, pattern, function ( match ) {
var start = arguments[ arguments.length - 2 ];
var end = start + match.length;
var content = callback.apply( null, arguments );
replacements.push({ start: start, end: end, content: content });
});
replacements.push({ start: start, end: end, content: content });
});
var replaced = '';
var lastIndex = 0;
var replaced = '';
var lastIndex = 0;
for ( var i = 0; i < replacements.length; i += 1 ) {
var ref = replacements[i], start = ref.start, end = ref.end, content = ref.content;
replaced += str.slice( lastIndex, start ) + content;
for ( var i = 0; i < replacements.length; i += 1 ) {
var ref = replacements[i], start = ref.start, end = ref.end, content = ref.content;
replaced += str.slice( lastIndex, start ) + content;
lastIndex = end;
}
lastIndex = end;
}
replaced += str.slice( lastIndex );
replaced += str.slice( lastIndex );
return replaced;
}
return replaced;
}
exports.find = find;
exports.erase = erase;
exports.match = match;
exports.replace = replace;
exports.find = find;
exports.erase = erase;
exports.match = match;
exports.replace = replace;
}));
//# sourceMappingURL=tippex.umd.js.map
Object.defineProperty(exports, '__esModule', { value: true });
})));
//# sourceMappingURL=tippex.umd.js.map
{
"name": "tippex",
"description": "Find and erase strings and comments in JavaScript code",
"version": "2.2.0",
"version": "2.3.0",
"author": "Rich Harris",

@@ -6,0 +6,0 @@ "main": "dist/tippex.umd.js",

@@ -60,3 +60,3 @@ # Tippex

...or download from npmcdn.com ([UMD version](https://npmcdn.com/tippex), [ES6 exports version](https://npmcdn.com/tippex/dist/tippex.es6.js)).
...or download from unpkg.com ([UMD version](https://unpkg.com/tippex), [ES6 exports version](https://unpkg.com/tippex/dist/tippex.es6.js)).

@@ -63,0 +63,0 @@

@@ -6,2 +6,3 @@ import getLocation from './getLocation.js';

const ambiguous = /(\}|\)|\+\+|--)\s*$/;
const beforeJsx = /^$|[=:;,\(\{\}\[|&+]\s*$/;

@@ -13,2 +14,3 @@ export function find ( str ) {

let pfixOp = false;
let jsxTagDepth = 0;
let stack = [];

@@ -32,3 +34,3 @@

if ( char === '"' || char === "'" ) return start = i, quote = char, string;
if ( char === '"' || char === "'" ) return start = i, quote = char, stack.push( base ), string;
if ( char === '`' ) return start = i, templateString;

@@ -43,2 +45,8 @@

if ( char === '<' ) {
let substr = str.substr( 0, i );
substr = _erase( substr, found ).trim();
if ( beforeJsx.test( substr ) ) return stack.push( base ), jsxTagStart;
}
return base;

@@ -86,3 +94,3 @@ }

return base;
return stack.pop();
}

@@ -128,2 +136,39 @@

// JSX is an XML-like extension to ECMAScript
// https://facebook.github.io/jsx/
function jsxTagStart ( char ) {
if ( char === '/' ) return jsxTagDepth--, jsxTag;
return jsxTagDepth++, jsxTag;
}
function jsxTag ( char, i ) {
if ( char === '"' || char === "'" ) return start = i, quote = char, stack.push( jsxTag ), string;
if ( char === '{' ) return stack.push( jsxTag ), base;
if ( char === '>' ) {
if ( jsxTagDepth <= 0 ) return base;
return jsx;
}
if ( char === '/' ) return jsxTagSelfClosing;
return jsxTag;
}
function jsxTagSelfClosing ( char ) {
if ( char === '>' ) {
jsxTagDepth--;
if ( jsxTagDepth <= 0 ) return base;
return jsx;
}
return jsxTag;
}
function jsx ( char ) {
if ( char === '{' ) return stack.push( jsx ), base;
if ( char === '<' ) return jsxTagStart;
return jsx;
}
function lineComment ( char, end ) {

@@ -130,0 +175,0 @@ if ( char === '\n' ) {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc