New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

coffee-lex

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

coffee-lex - npm Package Compare versions

Comparing version 8.1.1 to 8.1.2

62

dist/index.js

@@ -24,3 +24,3 @@ "use strict";

pending.unshift.apply(pending, calculateHeregexpPadding_1.default(source, pending));
pending.unshift.apply(pending, combinedLocationsForMultiwordOperators(pending, source));
pending.unshift.apply(pending, combinedLocationsForNegatedOperators(pending, source));
location = pending.shift();

@@ -35,23 +35,51 @@ if (previousLocation && previousLocation.type !== SourceType_1.default.SPACE) {

exports.default = lex;
function combinedLocationsForMultiwordOperators(stream, source) {
if (!stream.hasNext(SourceType_1.default.OPERATOR, SourceType_1.default.SPACE, SourceType_1.default.OPERATOR) &&
!stream.hasNext(SourceType_1.default.OPERATOR, SourceType_1.default.SPACE, SourceType_1.default.RELATION)) {
function combinedLocationsForNegatedOperators(stream, source) {
if (!stream.hasNext(SourceType_1.default.OPERATOR)) {
return [];
}
var not = stream.shift();
var space = stream.shift();
var operator = stream.shift();
var next = stream.peek();
if (source.slice(not.index, space.index) === 'not') {
var op = source.slice(operator.index, next.index);
switch (op) {
case 'in':
case 'of':
return [new SourceLocation_1.default(SourceType_1.default.RELATION, not.index)];
case 'instanceof':
return [new SourceLocation_1.default(SourceType_1.default.OPERATOR, not.index)];
var locationsToRestore = [];
function shift() {
var location = stream.shift();
locationsToRestore.push(location);
return location;
}
var not = shift();
var space = shift();
var text = source.slice(not.index, space.index);
var operator;
if (text === 'not') {
if (space.type === SourceType_1.default.SPACE) {
// It is a space, so the operator is at the next location.
operator = shift();
}
else {
// `not` must be followed by a space, so this isn't a match.
return locationsToRestore;
}
}
else if (text === '!') {
if (space.type === SourceType_1.default.SPACE) {
// It is a space, so the operator is at the next location.
operator = shift();
}
else {
// The optional space is missing, so the next thing must be the operator.
operator = space;
}
}
else {
// Not a negation token, so put them back.
return locationsToRestore;
}
var next = stream.peek();
var op = source.slice(operator.index, next.index);
switch (op) {
case 'in':
case 'of':
return [new SourceLocation_1.default(SourceType_1.default.RELATION, not.index)];
case 'instanceof':
return [new SourceLocation_1.default(SourceType_1.default.OPERATOR, not.index)];
}
// Doesn't match, so put them back.
return [not, space, operator];
return locationsToRestore;
}

@@ -58,0 +86,0 @@ var REGEXP_FLAGS = ['i', 'g', 'm', 'u', 'y'];

@@ -39,8 +39,8 @@ {

"@types/node": "^9.3.0",
"decaffeinate-coffeescript": "1.12.7-patch.1",
"decaffeinate-coffeescript": "1.12.7-patch.2",
"mocha": "^5.0.0",
"prettier": "1.10.2",
"prettier": "1.11.0",
"prettier-check": "2.0.0",
"semantic-release": "^6.3.5",
"ts-node": "^4.1.0",
"ts-node": "^5.0.0",
"tslint": "^5.8.0",

@@ -52,3 +52,3 @@ "typescript": "^2.6.2"

},
"version": "8.1.1"
"version": "8.1.2"
}

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