Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
29 lines (25 sloc) 590 Bytes
export class ngBase {
constructor(name, options) {
this.args = {
name : name,
options : options || {}
};
}
get name() { return this.args.name; }
get options() { return this.args.options; }
find(fn, name) {
return fn.annotations.filter((item, index) => {
return item.constructor.name === name;
});
}
wrap(fn) {
var result = [];
var injectAnnotation = this.find(fn, 'ngInject');
var inject = injectAnnotation.length > 0 ? injectAnnotation[0].inject : [];
for (var item of inject) {
result.push(item);
}
result.push(fn);
return result;
}
}