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

@journeyapps/evaluator

Package Overview
Dependencies
Maintainers
0
Versions
266
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@journeyapps/evaluator - npm Package Compare versions

Comparing version 0.0.0-dev.2b0f55f to 0.0.0-dev.30aa390

12

dist/@types/parsers/MemberExpressionParser.d.ts
import { MemberExpression } from '@babel/types';
import { FormatShorthandTokenExpression, FunctionTokenExpression, ShorthandTokenExpression } from '../token-expressions';
import { FormatShorthandTokenExpression, FunctionTokenExpression, ShorthandTokenExpression, ShorthandTokenExpressionOptions, TokenExpression } from '../token-expressions';
import { AbstractExpressionParser, ExpressionParserFactory, ExpressionNodeParseEvent } from './AbstractExpressionParser';
export type MemberExpressionParsedType = FunctionTokenExpression | ShorthandTokenExpression | FormatShorthandTokenExpression;
export declare class MemberExpressionParser extends AbstractExpressionParser<MemberExpression, MemberExpressionParsedType> {
parse(event: ExpressionNodeParseEvent<MemberExpression>): FunctionTokenExpression<{
expression: string;
}> | ShorthandTokenExpression<{
expression: string;
}>;
parse(event: ExpressionNodeParseEvent<MemberExpression>): ShorthandTokenExpression<ShorthandTokenExpressionOptions>;
static parseMember(event: ExpressionNodeParseEvent<MemberExpression>, properties?: TokenExpression[]): {
objectName: string;
properties: TokenExpression[];
};
}

@@ -12,0 +12,0 @@ export declare class MemberExpressionParserFactory extends ExpressionParserFactory<MemberExpressionParser> {

/**
* Shorthand token expression with format specifier.
*/
import { ShorthandTokenExpression } from './ShorthandTokenExpression';
import { TokenExpressionOptions } from '../TokenExpression';
export interface FormatShorthandTokenExpressionOptions extends TokenExpressionOptions {
import { ShorthandTokenExpression, ShorthandTokenExpressionOptions } from './ShorthandTokenExpression';
export interface FormatShorthandTokenExpressionOptions extends ShorthandTokenExpressionOptions {
format: string;

@@ -8,0 +7,0 @@ }

@@ -7,3 +7,7 @@ import { FormatStringScope } from '../../definitions/FormatStringScope';

*/
export declare class ShorthandTokenExpression<O extends TokenExpressionOptions = TokenExpressionOptions> extends TokenExpression<O> {
export interface ShorthandTokenExpressionOptions extends TokenExpressionOptions {
name?: string;
properties?: TokenExpression[];
}
export declare class ShorthandTokenExpression<O extends ShorthandTokenExpressionOptions = ShorthandTokenExpressionOptions> extends TokenExpression<O> {
static TYPE: string;

@@ -10,0 +14,0 @@ constructor(options: O);

@@ -13,2 +13,3 @@ import { FormatStringScope } from '../definitions/FormatStringScope';

isFunction?: boolean;
isComputed?: boolean;
}

@@ -15,0 +16,0 @@ export declare abstract class TokenExpression<O extends TokenExpressionOptions = TokenExpressionOptions, V extends any = any> {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MemberExpressionParserFactory = exports.MemberExpressionParser = void 0;
const types_1 = require("@babel/types");
const FunctionExpressionContext_1 = require("../context/FunctionExpressionContext");

@@ -12,10 +13,34 @@ const token_expressions_1 = require("../token-expressions");

const expr = source.slice(node.start, node.end);
const { objectName, properties } = MemberExpressionParser.parseMember(event);
const options = {
expression: expr,
name: objectName,
properties: properties
};
if (FunctionExpressionContext_1.FunctionExpressionContext.isInstanceOf(context)) {
return new token_expressions_1.FunctionTokenExpression({ expression: expr });
return new token_expressions_1.ShorthandTokenExpression(Object.assign(Object.assign({}, options), { isFunction: true }));
}
const format = (_a = node.extra) === null || _a === void 0 ? void 0 : _a.format;
return format != null
? new token_expressions_1.FormatShorthandTokenExpression({ expression: expr, format: format })
: new token_expressions_1.ShorthandTokenExpression({ expression: expr });
return format == null
? new token_expressions_1.ShorthandTokenExpression(options)
: new token_expressions_1.FormatShorthandTokenExpression(Object.assign(Object.assign({}, options), { format: format }));
}
static parseMember(event, properties = []) {
const { node, source, parseNode } = event;
if ((0, types_1.isIdentifier)(node.object)) {
const propertyExpr = parseNode({
node: node.property,
source: source.slice(node.property.start, node.property.end)
});
propertyExpr.options.isComputed = node.computed;
properties.push(propertyExpr);
return {
objectName: node.object.name,
properties: properties
};
}
const result = MemberExpressionParser.parseMember(Object.assign(Object.assign({}, event), { node: node.object }), properties);
result.properties.push(parseNode({ node: node.property, source: source.slice(node.property.start, node.property.end) }));
return result;
}
}

@@ -22,0 +47,0 @@ exports.MemberExpressionParser = MemberExpressionParser;

@@ -6,8 +6,6 @@ "use strict";

const TokenExpression_1 = require("../TokenExpression");
/**
* Shorthand token expression.
*/
class ShorthandTokenExpression extends TokenExpression_1.TokenExpression {
constructor(options) {
super(ShorthandTokenExpression.TYPE, Object.assign(Object.assign({}, options), { isShorthand: true }));
var _a;
super(ShorthandTokenExpression.TYPE, Object.assign(Object.assign({}, options), { isShorthand: true, name: (_a = options.name) !== null && _a !== void 0 ? _a : options.expression }));
}

@@ -14,0 +12,0 @@ async tokenEvaluatePromise(scope) {

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

this.type = type;
this.options = Object.assign({ isPrimitive: false, isConstant: false, isShorthand: false, isFunction: false }, options);
this.options = Object.assign({ isPrimitive: false, isConstant: false, isShorthand: false, isFunction: false, isComputed: false }, options);
this.expression = this.options.expression;

@@ -13,0 +13,0 @@ this.isPrimitive = this.options.isPrimitive;

{
"name": "@journeyapps/evaluator",
"version": "0.0.0-dev.2b0f55f",
"version": "0.0.0-dev.30aa390",
"description": "Journey Evaluator library",

@@ -15,3 +15,3 @@ "main": "./dist/index.js",

"lodash": "^4.17.21",
"@journeyapps/core-xml": "0.0.0-dev.2b0f55f"
"@journeyapps/core-xml": "0.0.0-dev.30aa390"
},

@@ -18,0 +18,0 @@ "devDependencies": {

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