本文整理汇总了TypeScript中plywood.Expression.parse方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Expression.parse方法的具体用法?TypeScript Expression.parse怎么用?TypeScript Expression.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plywood.Expression
的用法示例。
在下文中一共展示了Expression.parse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(parameters: DimensionValue) {
var name = parameters.name;
verifyUrlSafeName(name);
this.name = name;
this.title = parameters.title || makeTitle(name);
var formula = parameters.formula || $(name).toString();
this.formula = formula;
this.expression = Expression.parse(formula);
var kind = parameters.kind || typeToKind(this.expression.type) || 'string';
this.kind = kind;
if (kind === 'string' && isGeo(name)) {
this.className = 'string-geo';
} else {
this.className = kind;
}
if (parameters.url) {
if (typeof parameters.url !== 'string') {
throw new Error(`unsupported url: ${parameters.url}: only strings are supported`);
}
this.url = parameters.url;
}
if (parameters.granularities) {
if (parameters.granularities.length !== 5) throw new Error('there must be exactly 5 granularities');
this.granularities = parameters.granularities;
}
if (parameters.bucketedBy) this.bucketedBy = parameters.bucketedBy;
if (parameters.bucketingStrategy) this.bucketingStrategy = parameters.bucketingStrategy;
if (parameters.sortStrategy) this.sortStrategy = parameters.sortStrategy;
}