bem-xjst
Version:
Declarative Template Engine for the browser and server
27 lines (22 loc) • 643 B
JavaScript
var log = require('../logger');
var Transformer = require('../transformer');
var t = new Transformer();
module.exports = function(file, api, opts) {
t.description = 'this.mods always exists. You don’t need to check it.';
t.find = function(file, j) {
return j(file.source)
.find(j.LogicalExpression, {
left: {
type: 'MemberExpression',
object: { type: 'ThisExpression' },
property: { name: 'mods' }
}
});
};
t.replace = function(ret, j) {
return ret.map(function(item) {
return item.replace(item.value.right);
})
};
return t.run(file, api, opts);
};