3 exports.__esModule = true;
5 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
7 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
9 var cloneNode = function cloneNode(obj, parent) {
10 if ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') {
14 var cloned = new obj.constructor();
17 if (!obj.hasOwnProperty(i)) {
21 var type = typeof value === 'undefined' ? 'undefined' : _typeof(value);
23 if (i === 'parent' && type === 'object') {
27 } else if (value instanceof Array) {
28 cloned[i] = value.map(function (j) {
29 return cloneNode(j, cloned);
32 cloned[i] = cloneNode(value, cloned);
39 var _class = function () {
41 var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
43 _classCallCheck(this, _class);
45 Object.assign(this, opts);
46 this.spaces = this.spaces || {};
47 this.spaces.before = this.spaces.before || '';
48 this.spaces.after = this.spaces.after || '';
51 _class.prototype.remove = function remove() {
53 this.parent.removeChild(this);
55 this.parent = undefined;
59 _class.prototype.replaceWith = function replaceWith() {
61 for (var index in arguments) {
62 this.parent.insertBefore(this, arguments[index]);
69 _class.prototype.next = function next() {
70 return this.parent.at(this.parent.index(this) + 1);
73 _class.prototype.prev = function prev() {
74 return this.parent.at(this.parent.index(this) - 1);
77 _class.prototype.clone = function clone() {
78 var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
80 var cloned = cloneNode(this);
81 for (var name in overrides) {
82 cloned[name] = overrides[name];
87 _class.prototype.toString = function toString() {
88 return [this.spaces.before, String(this.value), this.spaces.after].join('');
94 exports.default = _class;
95 module.exports = exports['default'];