| 1 | "use strict";
|
|---|
| 2 |
|
|---|
| 3 | exports.__esModule = true;
|
|---|
| 4 | exports["default"] = void 0;
|
|---|
| 5 | var _container = _interopRequireDefault(require("./container"));
|
|---|
| 6 | var _types = require("./types");
|
|---|
| 7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|---|
| 8 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|---|
| 9 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|---|
| 10 | function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
|
|---|
| 11 | function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|---|
| 12 | var Root = /*#__PURE__*/function (_Container) {
|
|---|
| 13 | _inheritsLoose(Root, _Container);
|
|---|
| 14 | function Root(opts) {
|
|---|
| 15 | var _this;
|
|---|
| 16 | _this = _Container.call(this, opts) || this;
|
|---|
| 17 | _this.type = _types.ROOT;
|
|---|
| 18 | return _this;
|
|---|
| 19 | }
|
|---|
| 20 | var _proto = Root.prototype;
|
|---|
| 21 | _proto.toString = function toString() {
|
|---|
| 22 | var str = this.reduce(function (memo, selector) {
|
|---|
| 23 | memo.push(String(selector));
|
|---|
| 24 | return memo;
|
|---|
| 25 | }, []).join(',');
|
|---|
| 26 | return this.trailingComma ? str + ',' : str;
|
|---|
| 27 | };
|
|---|
| 28 | _proto.error = function error(message, options) {
|
|---|
| 29 | if (this._error) {
|
|---|
| 30 | return this._error(message, options);
|
|---|
| 31 | } else {
|
|---|
| 32 | return new Error(message);
|
|---|
| 33 | }
|
|---|
| 34 | };
|
|---|
| 35 | _createClass(Root, [{
|
|---|
| 36 | key: "errorGenerator",
|
|---|
| 37 | set: function set(handler) {
|
|---|
| 38 | this._error = handler;
|
|---|
| 39 | }
|
|---|
| 40 | }]);
|
|---|
| 41 | return Root;
|
|---|
| 42 | }(_container["default"]);
|
|---|
| 43 | exports["default"] = Root;
|
|---|
| 44 | module.exports = exports.default; |
|---|