You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
543 B
29 lines
543 B
'use strict';
|
|
|
|
var _ = require('lodash');
|
|
var Node = require(__dirname);
|
|
|
|
var AliasNode = Node.define({
|
|
type: 'ALIAS',
|
|
constructor: function(value, alias) {
|
|
Node.call(this);
|
|
|
|
this.value = value;
|
|
this.alias = alias;
|
|
}
|
|
});
|
|
|
|
var AliasMixin = {
|
|
as: function(alias) {
|
|
// create an alias node
|
|
var aliasNode = new AliasNode(this, alias);
|
|
|
|
// defaults the properties of the aliased node
|
|
_.defaults(aliasNode, this);
|
|
|
|
return aliasNode;
|
|
}
|
|
};
|
|
|
|
module.exports = AliasNode;
|
|
module.exports.AliasMixin = AliasMixin;
|
|
|