Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!dvExpr) { return { names: [], evaluate: () => undefined }; }
const match = grammar.match(dvExpr);
if (match.failed()) {
throw new Error(match.message);
}
const parsedExpr = semantics(match);
const names: string[] = (parsedExpr.getNames() as string[])
.map((name) => name
.replace(/\?/g, '') // ignore elvis operator
.split('.')
// tslint:disable-next-line no-magic-numbers
.slice(0, name.startsWith('$') ? 1 : 3) // $input or cliche.component.input
.join('.')
); // drop object path
const ngExpr: string = parsedExpr.toNgExpr();
const evaluate: (scope: Object) => any = expressions.compile(ngExpr);
return {
names,
evaluate,
parsedExpr
};
}
html('[ng-class], [data-ng-class]').each((i, el) => {
let cls = [];
let ngcl = html(el).attr('ng-class');
if (ngcl) {
ngcl = ngcl.replace('::','');
cls = cls.concat(
Object.keys(expressions.compile(ngcl)())
);
}
let datang = html(el).attr('data-ng-class');
if (datang) {
datang = datang.replace('::', '');
cls = cls.concat(
Object.keys(expressions.compile(datang)())
);
}
cls.forEach((cl) => {
html(el).addClass(cl);
});
});
return Promise.resolve();
html('[ng-class], [data-ng-class]').each((i, el) => {
let cls = [];
let ngcl = html(el).attr('ng-class');
if (ngcl) {
ngcl = ngcl.replace('::','');
cls = cls.concat(
Object.keys(expressions.compile(ngcl)())
);
}
let datang = html(el).attr('data-ng-class');
if (datang) {
datang = datang.replace('::', '');
cls = cls.concat(
Object.keys(expressions.compile(datang)())
);
}
cls.forEach((cl) => {
html(el).addClass(cl);
});
});
return Promise.resolve();
PowerTemplate.prototype.getValue = function (value) {
var regexp = module.exports.BINDINGS_RE;
var type = typeof value;
var match = null;
if (type === 'function') {
return value;
}
else if ((type === 'string') && (match = value.match(regexp))) {
return expressions.compile(match[ 1 ]);
}
else {
return value;
}
};
alertSchema.methods.validCondition = function(scope) {
var expr = expressions.compile(this.condition);
return expr(scope);
};