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

ifc-expressions

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ifc-expressions - npm Package Compare versions

Comparing version 2.0.1-beta.6 to 2.0.1-beta.7

dist/cjs/expression/function/arg/FuncArgRegexFlag.js

6

dist/cjs/compiler/TypeManager.js

@@ -52,5 +52,11 @@ "use strict";

}
isLogical(...ctxs) {
return this.isType(Types_js_1.Type.LOGICAL, ...ctxs);
}
overlapsWithBoolean(...ctxs) {
return this.overlapsWith(Types_js_1.Type.BOOLEAN, ...ctxs);
}
overlapsWithLogical(...ctxs) {
return this.overlapsWith(Types_js_1.Type.LOGICAL, ...ctxs);
}
isNumeric(...ctxs) {

@@ -57,0 +63,0 @@ return this.isType(Types_js_1.Type.NUMERIC, ...ctxs);

18

dist/cjs/expression/function/IfcExpressionFunctions.js

@@ -22,6 +22,18 @@ "use strict";

const IF_js_1 = require("./impl/IF.js");
const TONUMERIC_js_1 = require("./impl/TONUMERIC.js");
const IfcExpressionFunctionConfigException_js_1 = require("../../error/IfcExpressionFunctionConfigException.js");
const TOBOOLEAN_js_1 = require("./impl/TOBOOLEAN.js");
const builtinFunctions = new Map();
function registerFunc(func) {
builtinFunctions.set(IfcExpressionFunctions.normalizeName(func.getName()), func);
function registerOrDie(fnKey, func) {
if (builtinFunctions.has(fnKey)) {
throw new IfcExpressionFunctionConfigException_js_1.IfcExpressionFunctionConfigException(`cannot register function with name '${fnKey}': name already in use`);
}
builtinFunctions.set(fnKey, func);
}
function registerFunc(func, ...aliases) {
const fnKey = func.getName();
const keys = [...aliases];
keys.unshift(fnKey);
keys.forEach((key) => registerOrDie(IfcExpressionFunctions.normalizeName(key), func));
}
class IfcExpressionFunctions {

@@ -62,2 +74,4 @@ static normalizeName(name) {

registerFunc(new TOSTRING_js_1.TOSTRING());
registerFunc(new TONUMERIC_js_1.TONUMERIC(), "TONUMBER");
registerFunc(new TOBOOLEAN_js_1.TOBOOLEAN());
registerFunc(new EXISTS_js_1.EXISTS());

@@ -64,0 +78,0 @@ registerFunc(new FuncBooleanBinary_js_1.FuncBooleanBinary("AND", (left, right) => left && right));

@@ -10,2 +10,4 @@ "use strict";

const BooleanValue_js_1 = require("../../../value/BooleanValue.js");
const StringValue_js_1 = require("../../../value/StringValue.js");
const FuncArgRegexFlag_js_1 = require("../arg/FuncArgRegexFlag.js");
class ApplyRegex extends Func_js_1.Func {

@@ -18,5 +20,8 @@ constructor(name, simplePattern, requireFullMatch) {

: new FuncArgRegex_js_1.FuncArgRegex(true, ApplyRegex.KEY_PATTERN),
new FuncArgBoolean_js_1.FuncArgBoolean(false, ApplyRegex.KEY_CASE_INSENSITIVE, BooleanValue_js_1.BooleanValue.of(false)),
simplePattern
? new FuncArgBoolean_js_1.FuncArgBoolean(false, ApplyRegex.KEY_CASE_INSENSITIVE, BooleanValue_js_1.BooleanValue.of(false))
: new FuncArgRegexFlag_js_1.FuncArgRegexFlag(false, ApplyRegex.KEY_FLAGS, new StringValue_js_1.StringValue("gim")),
]);
this.requireFullMatch = requireFullMatch;
this.simplePattern = simplePattern;
}

@@ -28,2 +33,3 @@ }

ApplyRegex.KEY_CASE_INSENSITIVE = "caseInsensitive";
ApplyRegex.KEY_FLAGS = "flags";
//# sourceMappingURL=ApplyRegex.js.map

@@ -23,4 +23,12 @@ "use strict";

}
const caseSensitive = evaluatedArguments.get(MatchesPattern.KEY_CASE_INSENSITIVE);
const flags = caseSensitive.getValue() ? "im" : "m";
let flags = "m"; // default for simple pattern
if (this.simplePattern) {
const caseSensitive = evaluatedArguments.get(MatchesPattern.KEY_CASE_INSENSITIVE);
if (caseSensitive) {
flags = "im";
}
}
else {
flags = evaluatedArguments.get(MatchesPattern.KEY_FLAGS).getValue();
}
const regex = new RegExp(pattern, flags);

@@ -27,0 +35,0 @@ const input = inputValue.getValue();

@@ -29,4 +29,12 @@ "use strict";

}
const caseSensitive = evaluatedArguments.get(MatchesPattern_js_1.MatchesPattern.KEY_CASE_INSENSITIVE);
const flags = caseSensitive.getValue() ? "im" : "m";
let flags = "mg";
if (this.simplePattern) {
const caseSensitive = evaluatedArguments.get(MatchesPattern_js_1.MatchesPattern.KEY_CASE_INSENSITIVE);
if (caseSensitive.getValue()) {
flags = "img";
}
}
else {
flags = evaluatedArguments.get(ReplacePattern.KEY_FLAGS).getValue();
}
const regex = new RegExp(pattern, flags);

@@ -33,0 +41,0 @@ const input = inputValue.getValue();

5

dist/cjs/value/LogicalValue.js

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

toString() {
return this.logicalValue === "UNKNOWN"
return this.logicalValue === LogicalValue.UNKNOWN
? "UNKNOWN"

@@ -33,6 +33,7 @@ : this.logicalValue

typeof arg.logicalValue === "boolean") ||
arg.logicalValue === "UNKNOWN");
arg.logicalValue === LogicalValue.UNKNOWN);
}
}
exports.LogicalValue = LogicalValue;
LogicalValue.UNKNOWN = "UNKNOWN";
//# sourceMappingURL=LogicalValue.js.map

@@ -18,5 +18,7 @@ import { ParserRuleContext } from "antlr4";

isBoolean(...ctxs: any[]): boolean;
isLogical(...ctxs: any[]): boolean;
overlapsWithBoolean(...ctxs: any[]): boolean;
overlapsWithLogical(...ctxs: any[]): boolean;
isNumeric(...ctxs: any[]): boolean;
overlapsWithNumeric(...ctxs: any[]): boolean;
}

@@ -6,4 +6,6 @@ import { Func } from "../Func.js";

protected static readonly KEY_CASE_INSENSITIVE = "caseInsensitive";
protected static readonly KEY_FLAGS = "flags";
protected readonly requireFullMatch: boolean;
protected readonly simplePattern: boolean;
protected constructor(name: string, simplePattern: boolean, requireFullMatch: boolean);
}

@@ -49,5 +49,11 @@ import { Type, Types } from "../type/Types.js";

}
isLogical(...ctxs) {
return this.isType(Type.LOGICAL, ...ctxs);
}
overlapsWithBoolean(...ctxs) {
return this.overlapsWith(Type.BOOLEAN, ...ctxs);
}
overlapsWithLogical(...ctxs) {
return this.overlapsWith(Type.LOGICAL, ...ctxs);
}
isNumeric(...ctxs) {

@@ -54,0 +60,0 @@ return this.isType(Type.NUMERIC, ...ctxs);

@@ -19,6 +19,18 @@ import { isNullish } from "../../util/IfcExpressionUtils.js";

import { IF } from "./impl/IF.js";
import { TONUMERIC } from "./impl/TONUMERIC.js";
import { IfcExpressionFunctionConfigException } from "../../error/IfcExpressionFunctionConfigException.js";
import { TOBOOLEAN } from "./impl/TOBOOLEAN.js";
const builtinFunctions = new Map();
function registerFunc(func) {
builtinFunctions.set(IfcExpressionFunctions.normalizeName(func.getName()), func);
function registerOrDie(fnKey, func) {
if (builtinFunctions.has(fnKey)) {
throw new IfcExpressionFunctionConfigException(`cannot register function with name '${fnKey}': name already in use`);
}
builtinFunctions.set(fnKey, func);
}
function registerFunc(func, ...aliases) {
const fnKey = func.getName();
const keys = [...aliases];
keys.unshift(fnKey);
keys.forEach((key) => registerOrDie(IfcExpressionFunctions.normalizeName(key), func));
}
export class IfcExpressionFunctions {

@@ -58,2 +70,4 @@ static normalizeName(name) {

registerFunc(new TOSTRING());
registerFunc(new TONUMERIC(), "TONUMBER");
registerFunc(new TOBOOLEAN());
registerFunc(new EXISTS());

@@ -60,0 +74,0 @@ registerFunc(new FuncBooleanBinary("AND", (left, right) => left && right));

@@ -7,2 +7,4 @@ import { Func } from "../Func.js";

import { BooleanValue } from "../../../value/BooleanValue.js";
import { StringValue } from "../../../value/StringValue.js";
import { FuncArgRegexFlag } from "../arg/FuncArgRegexFlag.js";
export class ApplyRegex extends Func {

@@ -15,5 +17,8 @@ constructor(name, simplePattern, requireFullMatch) {

: new FuncArgRegex(true, ApplyRegex.KEY_PATTERN),
new FuncArgBoolean(false, ApplyRegex.KEY_CASE_INSENSITIVE, BooleanValue.of(false)),
simplePattern
? new FuncArgBoolean(false, ApplyRegex.KEY_CASE_INSENSITIVE, BooleanValue.of(false))
: new FuncArgRegexFlag(false, ApplyRegex.KEY_FLAGS, new StringValue("gim")),
]);
this.requireFullMatch = requireFullMatch;
this.simplePattern = simplePattern;
}

@@ -24,2 +29,3 @@ }

ApplyRegex.KEY_CASE_INSENSITIVE = "caseInsensitive";
ApplyRegex.KEY_FLAGS = "flags";
//# sourceMappingURL=ApplyRegex.js.map

@@ -20,4 +20,12 @@ import { ApplyRegex } from "./ApplyRegex.js";

}
const caseSensitive = evaluatedArguments.get(MatchesPattern.KEY_CASE_INSENSITIVE);
const flags = caseSensitive.getValue() ? "im" : "m";
let flags = "m"; // default for simple pattern
if (this.simplePattern) {
const caseSensitive = evaluatedArguments.get(MatchesPattern.KEY_CASE_INSENSITIVE);
if (caseSensitive) {
flags = "im";
}
}
else {
flags = evaluatedArguments.get(MatchesPattern.KEY_FLAGS).getValue();
}
const regex = new RegExp(pattern, flags);

@@ -24,0 +32,0 @@ const input = inputValue.getValue();

@@ -26,4 +26,12 @@ import { ApplyRegex } from "./ApplyRegex.js";

}
const caseSensitive = evaluatedArguments.get(MatchesPattern.KEY_CASE_INSENSITIVE);
const flags = caseSensitive.getValue() ? "im" : "m";
let flags = "mg";
if (this.simplePattern) {
const caseSensitive = evaluatedArguments.get(MatchesPattern.KEY_CASE_INSENSITIVE);
if (caseSensitive.getValue()) {
flags = "img";
}
}
else {
flags = evaluatedArguments.get(ReplacePattern.KEY_FLAGS).getValue();
}
const regex = new RegExp(pattern, flags);

@@ -30,0 +38,0 @@ const input = inputValue.getValue();

@@ -20,3 +20,3 @@ import { Type } from "../type/Types.js";

toString() {
return this.logicalValue === "UNKNOWN"
return this.logicalValue === LogicalValue.UNKNOWN
? "UNKNOWN"

@@ -30,5 +30,6 @@ : this.logicalValue

typeof arg.logicalValue === "boolean") ||
arg.logicalValue === "UNKNOWN");
arg.logicalValue === LogicalValue.UNKNOWN);
}
}
LogicalValue.UNKNOWN = "UNKNOWN";
//# sourceMappingURL=LogicalValue.js.map
import { Value } from "./Value.js";
import { ExprType } from "../type/ExprType.js";
export declare class LogicalValue implements Value<boolean | "UNKNOWN"> {
static readonly UNKNOWN = "UNKNOWN";
private readonly logicalValue;

@@ -5,0 +6,0 @@ constructor(value: boolean | "UNKNOWN");

{
"name": "ifc-expressions",
"version": "2.0.1-beta.6",
"version": "2.0.1-beta.7",
"description": "Parsing and evaluation of IFC expressions",

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

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