[Selection] At Path.toArray

This commit is contained in:
Victor Woeltjen 2016-08-22 12:17:29 -07:00
parent 6e664003e3
commit cc9efdff31

View File

@ -48,6 +48,10 @@ define([], function () {
return new Path(item, this);
};
Path.prototype.toArray = function () {
return [this.item].concat(this.parent.toArray());
};
NULL_PATH = new Path(undefined, undefined);
NULL_PATH.parent = NULL_PATH;
NULL_PATH.depth = function () {
@ -56,6 +60,9 @@ define([], function () {
NULL_PATH.matches = function (path) {
return path.depth() === 0;
};
NULL_PATH.toArray = function () {
return [];
};
return Path;
});