5e70e772d1a43cb1d6c33f7255aeb4f8f257b02add7ca080e6f9fa75077b5a8861b48a763ec79b07e6c5dc1e19d43f91228f619a575f3babd37da179e14fe0 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. 'use strict';
  2. exports.__esModule = true;
  3. var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4. var _node = require('./node');
  5. var _node2 = _interopRequireDefault(_node);
  6. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  10. var Namespace = function (_Node) {
  11. _inherits(Namespace, _Node);
  12. function Namespace() {
  13. _classCallCheck(this, Namespace);
  14. return _possibleConstructorReturn(this, _Node.apply(this, arguments));
  15. }
  16. Namespace.prototype.qualifiedName = function qualifiedName(value) {
  17. if (this.namespace) {
  18. return this.namespaceString + '|' + value;
  19. } else {
  20. return value;
  21. }
  22. };
  23. Namespace.prototype.toString = function toString() {
  24. return [this.spaces.before, this.qualifiedName(this.value), this.spaces.after].join('');
  25. };
  26. _createClass(Namespace, [{
  27. key: 'namespace',
  28. get: function get() {
  29. return this._namespace;
  30. },
  31. set: function set(namespace) {
  32. this._namespace = namespace;
  33. if (this.raws) {
  34. delete this.raws.namespace;
  35. }
  36. }
  37. }, {
  38. key: 'ns',
  39. get: function get() {
  40. return this._namespace;
  41. },
  42. set: function set(namespace) {
  43. this._namespace = namespace;
  44. if (this.raws) {
  45. delete this.raws.namespace;
  46. }
  47. }
  48. }, {
  49. key: 'namespaceString',
  50. get: function get() {
  51. if (this.namespace) {
  52. var ns = this.raws && this.raws.namespace || this.namespace;
  53. if (ns === true) {
  54. return '';
  55. } else {
  56. return ns;
  57. }
  58. } else {
  59. return '';
  60. }
  61. }
  62. }]);
  63. return Namespace;
  64. }(_node2.default);
  65. exports.default = Namespace;
  66. ;
  67. module.exports = exports['default'];