@journeyapps/evaluator
Advanced tools
Comparing version 0.0.0-dev.ae608c2.224c284 to 0.0.0-dev.afc96e8
@@ -5,6 +5,2 @@ import { TokenExpression } from './token-expressions/TokenExpression'; | ||
import { FormatStringScope } from './FormatStringScope'; | ||
export declare enum FormatStringOrigin { | ||
CONTENT = "content", | ||
ATTRIBUTE = "attribute" | ||
} | ||
/** | ||
@@ -14,6 +10,8 @@ * Construct a new format string expression. | ||
export declare class FormatString { | ||
static TYPE: string; | ||
type: string; | ||
expression: string; | ||
tokens: TokenExpression[]; | ||
origin: FormatStringOrigin; | ||
constructor(expression: string, origin?: FormatStringOrigin); | ||
constructor(expression: string); | ||
static isInstanceOf(val: any): val is FormatString; | ||
toString(): string; | ||
@@ -20,0 +18,0 @@ /** |
@@ -5,3 +5,3 @@ import { TokenExpression } from './token-expressions/TokenExpression'; | ||
import { FormatShorthandTokenExpression } from './token-expressions/FormatShorthandTokenExpression'; | ||
import { FormatString, FormatStringOrigin } from './FormatString'; | ||
import { FormatString } from './FormatString'; | ||
import { TypeInterface } from './TypeInterface'; | ||
@@ -25,3 +25,3 @@ import { LegacyFunctionTokenExpression } from './token-expressions/LegacyFunctionTokenExpression'; | ||
*/ | ||
export declare function formatString(expression: string, origin?: FormatStringOrigin): FormatString | null; | ||
export declare function formatString(expression: string): FormatString | null; | ||
/** | ||
@@ -28,0 +28,0 @@ # Construct a function token expression from a raw expression string. |
export interface TypeInterface { | ||
name: string; | ||
isPrimitiveType: boolean; | ||
getVariable(expression: string): any; | ||
getVariableTypeAndNameWithParent(expression: string): any; | ||
@@ -10,2 +11,3 @@ getType(expression: string): TypeInterface | null; | ||
stringify(): string; | ||
objectType?: TypeInterface; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FormatString = void 0; | ||
const tools_1 = require("./tools"); | ||
var FormatStringOrigin; | ||
(function (FormatStringOrigin) { | ||
FormatStringOrigin["CONTENT"] = "content"; | ||
FormatStringOrigin["ATTRIBUTE"] = "attribute"; | ||
})(FormatStringOrigin = exports.FormatStringOrigin || (exports.FormatStringOrigin = {})); | ||
/** | ||
@@ -13,7 +9,10 @@ * Construct a new format string expression. | ||
class FormatString { | ||
constructor(expression, origin = FormatStringOrigin.ATTRIBUTE) { | ||
constructor(expression) { | ||
this.expression = expression || ''; | ||
this.tokens = tools_1.compile(this.expression); | ||
this.origin = origin; | ||
this.tokens = (0, tools_1.compile)(this.expression); | ||
this.type = FormatString.TYPE; | ||
} | ||
static isInstanceOf(val) { | ||
return (val === null || val === void 0 ? void 0 : val.type) === FormatString.TYPE; | ||
} | ||
toString() { | ||
@@ -45,3 +44,3 @@ return this.expression; | ||
var expression = token.expression; | ||
tools_1.extract(type, expression, result, depth); | ||
(0, tools_1.extract)(type, expression, result, depth); | ||
} | ||
@@ -178,3 +177,3 @@ } | ||
const type = scope.getExpressionType(expression); | ||
const text = tools_1.formatValue(value, type, token.format); | ||
const text = (0, tools_1.formatValue)(value, type, token.format); | ||
result += text; | ||
@@ -188,2 +187,3 @@ } | ||
exports.FormatString = FormatString; | ||
FormatString.TYPE = 'format-string'; | ||
//# sourceMappingURL=FormatString.js.map |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./token-expressions/ConstantTokenExpression")); | ||
__export(require("./token-expressions/FormatShorthandTokenExpression")); | ||
__export(require("./token-expressions/FunctionTokenExpression")); | ||
__export(require("./token-expressions/LegacyFunctionTokenExpression")); | ||
__export(require("./token-expressions/PrimitiveConstantTokenExpression")); | ||
__export(require("./token-expressions/ShorthandTokenExpression")); | ||
__export(require("./token-expressions/TokenExpression")); | ||
__export(require("./FormatString")); | ||
__export(require("./tools")); | ||
__export(require("./VariableFormatStringScope")); | ||
__exportStar(require("./token-expressions/ConstantTokenExpression"), exports); | ||
__exportStar(require("./token-expressions/FormatShorthandTokenExpression"), exports); | ||
__exportStar(require("./token-expressions/FunctionTokenExpression"), exports); | ||
__exportStar(require("./token-expressions/LegacyFunctionTokenExpression"), exports); | ||
__exportStar(require("./token-expressions/PrimitiveConstantTokenExpression"), exports); | ||
__exportStar(require("./token-expressions/ShorthandTokenExpression"), exports); | ||
__exportStar(require("./token-expressions/TokenExpression"), exports); | ||
__exportStar(require("./FormatString"), exports); | ||
__exportStar(require("./tools"), exports); | ||
__exportStar(require("./TypeInterface"), exports); | ||
__exportStar(require("./ObjectRefInterface"), exports); | ||
__exportStar(require("./FormatStringScope"), exports); | ||
__exportStar(require("./VariableFormatStringScope"), exports); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ConstantTokenExpression = void 0; | ||
/** | ||
@@ -4,0 +5,0 @@ * Constant token expression. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FormatShorthandTokenExpression = void 0; | ||
/** | ||
@@ -20,11 +21,3 @@ * Shorthand token expression with format specifier. | ||
toString() { | ||
return ('[object ' + | ||
this.constructor.name + | ||
' <' + | ||
this.expression + | ||
', ' + | ||
this.start + | ||
', ' + | ||
this.format + | ||
'>]'); | ||
return '[object ' + this.constructor.name + ' <' + this.expression + ', ' + this.start + ', ' + this.format + '>]'; | ||
} | ||
@@ -38,3 +31,3 @@ async tokenEvaluatePromise(scope) { | ||
const type = scope.getExpressionType(expression); | ||
return tools_1.formatValueAsync(value, type, this.format); | ||
return (0, tools_1.formatValueAsync)(value, type, this.format); | ||
} | ||
@@ -41,0 +34,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FunctionTokenExpression = void 0; | ||
/** | ||
@@ -35,4 +36,3 @@ * JavaScript function token expression. | ||
toConstant(includeEscapeTags) { | ||
if (typeof includeEscapeTags === 'undefined' || | ||
includeEscapeTags === null) { | ||
if (typeof includeEscapeTags === 'undefined' || includeEscapeTags === null) { | ||
includeEscapeTags = false; | ||
@@ -54,2 +54,3 @@ } | ||
} | ||
exports.FunctionTokenExpression = FunctionTokenExpression; | ||
/** | ||
@@ -59,3 +60,2 @@ * Prefix for function token expressions. | ||
FunctionTokenExpression.PREFIX = '$:'; | ||
exports.FunctionTokenExpression = FunctionTokenExpression; | ||
//# sourceMappingURL=FunctionTokenExpression.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LegacyFunctionTokenExpression = void 0; | ||
/** | ||
@@ -4,0 +5,0 @@ * Legacy function token expression. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PrimitiveConstantTokenExpression = void 0; | ||
/** | ||
@@ -4,0 +5,0 @@ * Non-String Constant token expression |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ShorthandTokenExpression = void 0; | ||
/** | ||
@@ -22,3 +23,3 @@ * Shorthand token expression. | ||
const type = scope.getExpressionType(expression); | ||
return tools_1.formatValueAsync(value, type, this.format); | ||
return (0, tools_1.formatValueAsync)(value, type, this.format); | ||
} | ||
@@ -25,0 +26,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TokenExpression = void 0; | ||
class TokenExpression { | ||
@@ -17,9 +18,3 @@ constructor(expression, start) { | ||
toString() { | ||
return ('[object ' + | ||
this.constructor.name + | ||
' <' + | ||
this.expression + | ||
', ' + | ||
this.start + | ||
'>]'); | ||
return '[object ' + this.constructor.name + ' <' + this.expression + ', ' + this.start + '>]'; | ||
} | ||
@@ -26,0 +21,0 @@ isConstant() { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports._deepMerge = exports._compile = exports.formatValueAsync = exports.formatValue = exports.actionableTokenExpression = exports.functionTokenExpression = exports.formatString = exports.extract = exports.deepMerge = exports.getObjectType = exports.compile = exports.parseEnclosingBraces = exports.unescape = void 0; | ||
const ConstantTokenExpression_1 = require("./token-expressions/ConstantTokenExpression"); | ||
@@ -212,3 +213,3 @@ const FunctionTokenExpression_1 = require("./token-expressions/FunctionTokenExpression"); | ||
*/ | ||
function formatString(expression, origin = FormatString_1.FormatStringOrigin.ATTRIBUTE) { | ||
function formatString(expression) { | ||
if (expression == null) { | ||
@@ -218,3 +219,3 @@ return null; | ||
else { | ||
return new FormatString_1.FormatString(expression, origin); | ||
return new FormatString_1.FormatString(expression); | ||
} | ||
@@ -221,0 +222,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VariableFormatStringScope = void 0; | ||
class VariableFormatStringScope { | ||
@@ -4,0 +5,0 @@ constructor(variableScope) { |
{ | ||
"name": "@journeyapps/evaluator", | ||
"version": "0.0.0-dev.ae608c2.224c284", | ||
"version": "0.0.0-dev.afc96e8", | ||
"description": "Journey JS library", | ||
@@ -9,3 +9,3 @@ "main": "./dist/src/index.js", | ||
"build": "../node_modules/.bin/tsc --build", | ||
"test": "yarn build && yarn test:node && yarn test:browser", | ||
"test": "pnpm build && pnpm test:node && pnpm test:browser", | ||
"test:browser": "karma start karma.conf.js --single-run", | ||
@@ -15,3 +15,3 @@ "test:node": "jasmine dist/test/unit/all.js" | ||
"dependencies": { | ||
"@journeyapps/core-xml": "0.0.0-dev.ae608c2.224c284" | ||
"@journeyapps/core-xml": "0.0.0-dev.afc96e8" | ||
}, | ||
@@ -22,3 +22,10 @@ "files": [ | ||
], | ||
"gitHead": "e1cedf0b9f9515cbca7436ed517e9bbdad9560b4" | ||
"devDependencies": { | ||
"@journeyapps/core-test-helpers": "^4.1.1" | ||
}, | ||
"pnpm": { | ||
"overrides": { | ||
"@journeyapps/core-test-helpers": "link:../test-helpers" | ||
} | ||
} | ||
} |
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
124225
1161
275
9
9
68
1
4
+ Added@journeyapps/core-xml@0.0.0-dev.afc96e8(transitive)
+ Addedxmldom@0.6.0(transitive)
- Removed@journeyapps/core-xml@0.0.0-dev.ae608c2.224c284(transitive)