本文整理匯總了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;
}