@contentful/rich-text-types
Version:
Type definitions and constants for the Contentful rich text field type.
34 lines • 1.14 kB
JavaScript
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Path = void 0;
var Path = /** @class */ (function () {
function Path(path) {
if (path === void 0) { path = []; }
var _this = this;
this.path = path;
this.of = function (element) {
return new Path(__spreadArray(__spreadArray([], _this.path, true), [element], false));
};
this.isRoot = function () {
return _this.path.length === 0;
};
this.last = function () {
return _this.path[_this.path.length - 1];
};
this.toArray = function () {
return _this.path;
};
}
return Path;
}());
exports.Path = Path;
//# sourceMappingURL=path.js.map
;