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

@daikonjs/nearley

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@daikonjs/nearley - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

package.json
{
"name": "@daikonjs/nearley",
"version": "0.0.1",
"version": "0.0.2",
"description": "Nearley syntax definitions for Daikon.",

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

@@ -127,4 +127,9 @@ import { parseExpression } from "./expressions.js";

});
// expect(await parseExpression('get "a" in "rain"')).toStrictEqual([1]);
// expect(await parseExpression('get /a/g in "rain"')).toStrictEqual([1]);
expect(await parseExpression('get "a" in "rain"')).toStrictEqual([1]);
expect(
await parseExpression('get /a/ in "rain on my parade"')
).toStrictEqual([1]);
expect(
await parseExpression('get /a/g in "rain on my parade"')
).toStrictEqual([1, 12, 14]);
expect(await parseExpression('indexOf "t" "this is a test"')).toStrictEqual(

@@ -359,2 +364,54 @@ {

});
it("should parse boolean expressions", async () => {
// Equality
expect(await parseExpression("true == false")).toStrictEqual({
type: "boolean",
value: false,
});
expect(await parseExpression("true != false")).toStrictEqual({
type: "boolean",
value: true,
});
expect(await parseExpression("true == true")).toStrictEqual({
type: "boolean",
value: true,
});
expect(await parseExpression("true != true")).toStrictEqual({
type: "boolean",
value: false,
});
// Logical operators
expect(await parseExpression("true && false")).toStrictEqual({
type: "boolean",
value: false,
});
expect(await parseExpression("true || false")).toStrictEqual({
type: "boolean",
value: true,
});
expect(await parseExpression("true && true")).toStrictEqual({
type: "boolean",
value: true,
});
expect(await parseExpression("true || true")).toStrictEqual({
type: "boolean",
value: true,
});
expect(await parseExpression("false && false")).toStrictEqual({
type: "boolean",
value: false,
});
expect(await parseExpression("false || false")).toStrictEqual({
type: "boolean",
value: false,
});
// Inversion
expect(await parseExpression("true == !false")).toStrictEqual({
type: "boolean",
value: true,
});
});
});

@@ -6,2 +6,10 @@ // @ts-ignore

it("debug", () => {
expect(
parseValues('urls[]=url("https://pastebin.com/raw/Na2Hmfm8")')
).toStrictEqual({
slug: "urls[]",
type: "url",
value: "https://pastebin.com/raw/Na2Hmfm8",
});
expect(parseValues('hello="world"')).toStrictEqual({

@@ -22,2 +30,7 @@ slug: "hello",

});
expect(parseValues("test[]=2")).toStrictEqual({
type: "number",
slug: "test[]",
value: 2,
});
expect(parseValues("test ='world'")).toStrictEqual({

@@ -43,2 +56,32 @@ type: "string",

});
expect(parseValues('test=url("https://elk.wtf")')).toStrictEqual({
type: "url",
slug: "test",
value: "https://elk.wtf",
});
expect(parseValues('test=path("./config.daikon")')).toStrictEqual({
type: "path",
slug: "test",
value: "./config.daikon",
});
expect(parseValues("test=string(2)")).toStrictEqual({
type: "string",
slug: "test",
value: "2",
});
expect(parseValues("test=boolean(1)")).toStrictEqual({
type: "boolean",
slug: "test",
value: true,
});
expect(parseValues("test=boolean(0)")).toStrictEqual({
type: "boolean",
slug: "test",
value: false,
});
expect(parseValues('test=number("2")')).toStrictEqual({
type: "number",
slug: "test",
value: 2,
});
expect(parseValues("test=fn.add 1 2")).toStrictEqual({

@@ -45,0 +88,0 @@ type: "function",

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

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

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

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