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

segmenta

Package Overview
Dependencies
Maintainers
7
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

segmenta - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

dist/lib/dsl/validation.d.ts

9

CHANGELOG.md

@@ -0,1 +1,10 @@

<a name="1.0.10"></a>
### 1.0.10 (2018-05-28)
#### Features
* more validation on queries for clearer error reporting & non-silly results ([af934a18](git+https://github.com/codeo-za/segmenta.git/commit/af934a18))
<a name="1.0.9"></a>

@@ -2,0 +11,0 @@ ### 1.0.9 (2018-05-28)

6

dist/lib/dsl/tokenize.d.ts

@@ -13,6 +13,10 @@ export declare enum TokenTypes {

}
export interface IToken {
export interface ISimpleToken {
type: TokenTypes;
value?: string;
}
export interface IToken extends ISimpleToken {
line: number;
char: number;
}
export declare function tokenize(code: string): IToken[];

19

dist/lib/dsl/tokenize.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const validation_1 = require("./validation");
var TokenTypes;

@@ -53,4 +54,8 @@ (function (TokenTypes) {

}
function generateSyntaxErrorFor(allCode, current) {
const absolutePos = allCode.length - current.length, lines = allCode.substr(0, absolutePos).split(new RegExp("\\r\\n|\\n|\\r")), linePos = lines.length, charPos = lines[linePos - 1].length + 1, partial = current.length > 10 ? current.substr(0, 10) + "..." : current;
function codePos(allCode, current) {
const absolutePos = allCode.length - current.length, lines = allCode.substr(0, absolutePos).split(new RegExp("\\r\\n|\\n|\\r")), linePos = lines.length, charPos = lines[linePos - 1].length + 1;
return [linePos, charPos];
}
function generateSyntaxErrorFor(current, linePos, charPos) {
const partial = current.length > 10 ? current.substr(0, 10) + "..." : current;
return `Syntax error (line ${linePos}, char ${charPos}): '${partial}'`;

@@ -62,2 +67,3 @@ }

while (currentCode) {
const [line, char] = codePos(code, currentCode);
const thisToken = tokenTypes.reduce((acc, cur) => {

@@ -69,3 +75,3 @@ if (acc) {

return match && match.index === 0
? { type: cur.type, match }
? { type: cur.type, match, line, char }
: acc;

@@ -76,3 +82,3 @@ }, undefined);

thisToken.match.index === undefined) {
throw new Error(generateSyntaxErrorFor(code, currentCode));
throw new Error(generateSyntaxErrorFor(currentCode, line, char));
}

@@ -84,3 +90,5 @@ else {

? sanitizeIdentifier(thisToken.match[0])
: undefined
: undefined,
line,
char
});

@@ -90,4 +98,5 @@ currentCode = currentCode.substr(thisToken.match[0].length).trim();

}
validation_1.validate(result);
return result;
}
exports.tokenize = tokenize;
{
"name": "segmenta",
"version": "1.0.9",
"version": "1.0.10",
"description": "A blazingly fast API for managing and querying arbitrary data segments stored in Redis",

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

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