@socketsecurity/cli-with-sentry 0.14.137 → 0.14.139

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/blessed/LICENSE +20 -0
  2. package/dist/blessed/lib/alias.js +519 -0
  3. package/dist/blessed/lib/blessed.js +32 -0
  4. package/dist/blessed/lib/colors.js +490 -0
  5. package/dist/blessed/lib/events.js +195 -0
  6. package/dist/blessed/lib/gpmclient.js +245 -0
  7. package/dist/blessed/lib/helpers.js +170 -0
  8. package/dist/blessed/lib/keys.js +512 -0
  9. package/dist/blessed/lib/program.js +4530 -0
  10. package/dist/blessed/lib/tput.js +3111 -0
  11. package/dist/blessed/lib/unicode.js +912 -0
  12. package/dist/blessed/lib/widget.js +60 -0
  13. package/dist/blessed/lib/widgets/ansiimage.js +173 -0
  14. package/dist/blessed/lib/widgets/bigtext.js +170 -0
  15. package/dist/blessed/lib/widgets/box.js +34 -0
  16. package/dist/blessed/lib/widgets/button.js +62 -0
  17. package/dist/blessed/lib/widgets/checkbox.js +95 -0
  18. package/dist/blessed/lib/widgets/element.js +2871 -0
  19. package/dist/blessed/lib/widgets/filemanager.js +223 -0
  20. package/dist/blessed/lib/widgets/form.js +301 -0
  21. package/dist/blessed/lib/widgets/image.js +71 -0
  22. package/dist/blessed/lib/widgets/input.js +34 -0
  23. package/dist/blessed/lib/widgets/layout.js +249 -0
  24. package/dist/blessed/lib/widgets/line.js +59 -0
  25. package/dist/blessed/lib/widgets/list.js +652 -0
  26. package/dist/blessed/lib/widgets/listbar.js +452 -0
  27. package/dist/blessed/lib/widgets/listtable.js +265 -0
  28. package/dist/blessed/lib/widgets/loading.js +88 -0
  29. package/dist/blessed/lib/widgets/log.js +82 -0
  30. package/dist/blessed/lib/widgets/message.js +145 -0
  31. package/dist/blessed/lib/widgets/node.js +314 -0
  32. package/dist/blessed/lib/widgets/overlayimage.js +794 -0
  33. package/dist/blessed/lib/widgets/progressbar.js +166 -0
  34. package/dist/blessed/lib/widgets/prompt.js +127 -0
  35. package/dist/blessed/lib/widgets/question.js +129 -0
  36. package/dist/blessed/lib/widgets/radiobutton.js +62 -0
  37. package/dist/blessed/lib/widgets/radioset.js +36 -0
  38. package/dist/blessed/lib/widgets/screen.js +2485 -0
  39. package/dist/blessed/lib/widgets/scrollablebox.js +415 -0
  40. package/dist/blessed/lib/widgets/scrollabletext.js +35 -0
  41. package/dist/blessed/lib/widgets/table.js +383 -0
  42. package/dist/blessed/lib/widgets/terminal.js +452 -0
  43. package/dist/blessed/lib/widgets/text.js +35 -0
  44. package/dist/blessed/lib/widgets/textarea.js +376 -0
  45. package/dist/blessed/lib/widgets/textbox.js +79 -0
  46. package/dist/blessed/lib/widgets/video.js +130 -0
  47. package/dist/blessed/usr/fonts/AUTHORS +1 -0
  48. package/dist/blessed/usr/fonts/LICENSE +94 -0
  49. package/dist/blessed/usr/fonts/README +340 -0
  50. package/dist/blessed/usr/fonts/ter-u14b.json +17826 -0
  51. package/dist/blessed/usr/fonts/ter-u14n.json +17826 -0
  52. package/dist/blessed/usr/linux +0 -0
  53. package/dist/blessed/usr/windows-ansi +0 -0
  54. package/dist/blessed/usr/xterm +0 -0
  55. package/dist/blessed/usr/xterm-256color +0 -0
  56. package/dist/blessed/usr/xterm.termcap +243 -0
  57. package/dist/blessed/usr/xterm.terminfo +1977 -0
  58. package/dist/blessed/vendor/tng.js +1876 -0
  59. package/dist/blessed-contrib/LICENSE.md +21 -0
  60. package/dist/blessed-contrib/lib/layout/carousel.js +82 -0
  61. package/dist/blessed-contrib/lib/layout/grid.js +46 -0
  62. package/dist/blessed-contrib/lib/server-utils.js +83 -0
  63. package/dist/blessed-contrib/lib/utils.js +73 -0
  64. package/dist/blessed-contrib/lib/widget/canvas.js +52 -0
  65. package/dist/blessed-contrib/lib/widget/charts/bar.js +99 -0
  66. package/dist/blessed-contrib/lib/widget/charts/line.js +311 -0
  67. package/dist/blessed-contrib/lib/widget/charts/stacked-bar.js +245 -0
  68. package/dist/blessed-contrib/lib/widget/donut.js +183 -0
  69. package/dist/blessed-contrib/lib/widget/gauge-list.js +111 -0
  70. package/dist/blessed-contrib/lib/widget/gauge.js +127 -0
  71. package/dist/blessed-contrib/lib/widget/lcd.js +497 -0
  72. package/dist/blessed-contrib/lib/widget/log.js +32 -0
  73. package/dist/blessed-contrib/lib/widget/map.js +97 -0
  74. package/dist/blessed-contrib/lib/widget/markdown.js +68 -0
  75. package/dist/blessed-contrib/lib/widget/picture.js +61 -0
  76. package/dist/blessed-contrib/lib/widget/sparkline.js +66 -0
  77. package/dist/blessed-contrib/lib/widget/table.js +141 -0
  78. package/dist/blessed-contrib/lib/widget/tree.js +179 -0
  79. package/dist/blessed-contrib/node_modules/ansi-regex/index.js +6 -0
  80. package/dist/blessed-contrib/node_modules/ansi-regex/license +21 -0
  81. package/dist/blessed-contrib/node_modules/ansi-regex/package.json +64 -0
  82. package/dist/blessed-contrib/node_modules/ansi-regex/readme.md +39 -0
  83. package/dist/blessed-contrib/node_modules/ansi-styles/index.js +67 -0
  84. package/dist/blessed-contrib/node_modules/ansi-styles/license +21 -0
  85. package/dist/blessed-contrib/node_modules/ansi-styles/package.json +50 -0
  86. package/dist/blessed-contrib/node_modules/ansi-styles/readme.md +86 -0
  87. package/dist/blessed-contrib/node_modules/chalk/index.js +118 -0
  88. package/dist/blessed-contrib/node_modules/chalk/license +21 -0
  89. package/dist/blessed-contrib/node_modules/chalk/package.json +70 -0
  90. package/dist/blessed-contrib/node_modules/chalk/readme.md +213 -0
  91. package/dist/blessed-contrib/node_modules/escape-string-regexp/index.js +13 -0
  92. package/dist/blessed-contrib/node_modules/escape-string-regexp/license +21 -0
  93. package/dist/blessed-contrib/node_modules/escape-string-regexp/package.json +41 -0
  94. package/dist/blessed-contrib/node_modules/escape-string-regexp/readme.md +27 -0
  95. package/dist/blessed-contrib/node_modules/strip-ansi/index.js +8 -0
  96. package/dist/blessed-contrib/node_modules/strip-ansi/license +21 -0
  97. package/dist/blessed-contrib/node_modules/strip-ansi/package.json +57 -0
  98. package/dist/blessed-contrib/node_modules/strip-ansi/readme.md +33 -0
  99. package/dist/blessed-contrib/node_modules/supports-color/index.js +52 -0
  100. package/dist/blessed-contrib/node_modules/supports-color/license +21 -0
  101. package/dist/blessed-contrib/node_modules/supports-color/package.json +49 -0
  102. package/dist/blessed-contrib/node_modules/supports-color/readme.md +36 -0
  103. package/dist/cli.js +9 -8
  104. package/dist/cli.js.map +1 -1
  105. package/dist/instrument-with-sentry.js +2 -2
  106. package/dist/instrument-with-sentry.js.map +1 -1
  107. package/dist/shadow-npm-inject.js +2 -2
  108. package/dist/shadow-npm-inject.js.map +1 -1
  109. package/package.json +4 -4
@@ -0,0 +1,88 @@
1
+ /**
2
+ * loading.js - loading element for blessed
3
+ * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
4
+ * https://github.com/chjj/blessed
5
+ */
6
+
7
+ /**
8
+ * Modules
9
+ */
10
+
11
+ const Node = require('./node')
12
+ const Box = require('./box')
13
+ const Text = require('./text')
14
+
15
+ /**
16
+ * Loading
17
+ */
18
+
19
+ function Loading(options) {
20
+ if (!(this instanceof Node)) {
21
+ return new Loading(options)
22
+ }
23
+
24
+ options = options || {}
25
+
26
+ Box.call(this, options)
27
+
28
+ this._.icon = new Text({
29
+ parent: this,
30
+ align: 'center',
31
+ top: 2,
32
+ left: 1,
33
+ right: 1,
34
+ height: 1,
35
+ content: '|'
36
+ })
37
+ }
38
+
39
+ Object.setPrototypeOf(Loading.prototype, Box.prototype)
40
+
41
+ Loading.prototype.type = 'loading'
42
+
43
+ Loading.prototype.load = function (text) {
44
+ const self = this
45
+
46
+ // XXX Keep above:
47
+ // var parent = this.parent;
48
+ // this.detach();
49
+ // parent.append(this);
50
+
51
+ this.show()
52
+ this.setContent(text)
53
+
54
+ if (this._.timer) {
55
+ this.stop()
56
+ }
57
+
58
+ this.screen.lockKeys = true
59
+
60
+ this._.timer = setInterval(function () {
61
+ if (self._.icon.content === '|') {
62
+ self._.icon.setContent('/')
63
+ } else if (self._.icon.content === '/') {
64
+ self._.icon.setContent('-')
65
+ } else if (self._.icon.content === '-') {
66
+ self._.icon.setContent('\\')
67
+ } else if (self._.icon.content === '\\') {
68
+ self._.icon.setContent('|')
69
+ }
70
+ self.screen.render()
71
+ }, 200)
72
+ }
73
+
74
+ Loading.prototype.stop = function () {
75
+ this.screen.lockKeys = false
76
+ this.hide()
77
+ if (this._.timer) {
78
+ clearInterval(this._.timer)
79
+ delete this._.timer
80
+ }
81
+ this.screen.render()
82
+ }
83
+
84
+ /**
85
+ * Expose
86
+ */
87
+
88
+ module.exports = Loading
@@ -0,0 +1,82 @@
1
+ /**
2
+ * log.js - log element for blessed
3
+ * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
4
+ * https://github.com/chjj/blessed
5
+ */
6
+
7
+ /**
8
+ * Modules
9
+ */
10
+
11
+ const util = require('node:util')
12
+
13
+ const nextTick = global.setImmediate || process.nextTick.bind(process)
14
+
15
+ const Node = require('./node')
16
+ const ScrollableText = require('./scrollabletext')
17
+
18
+ /**
19
+ * Log
20
+ */
21
+
22
+ function Log(options) {
23
+ const self = this
24
+
25
+ if (!(this instanceof Node)) {
26
+ return new Log(options)
27
+ }
28
+
29
+ options = options || {}
30
+
31
+ ScrollableText.call(this, options)
32
+
33
+ this.scrollback = options.scrollback != null ? options.scrollback : Infinity
34
+ this.scrollOnInput = options.scrollOnInput
35
+
36
+ this.on('set content', function () {
37
+ if (!self._userScrolled || self.scrollOnInput) {
38
+ nextTick(function () {
39
+ self.setScrollPerc(100)
40
+ self._userScrolled = false
41
+ self.screen.render()
42
+ })
43
+ }
44
+ })
45
+ }
46
+
47
+ Object.setPrototypeOf(Log.prototype, ScrollableText.prototype)
48
+
49
+ Log.prototype.type = 'log'
50
+
51
+ Log.prototype.log = Log.prototype.add = function () {
52
+ const args = Array.prototype.slice.call(arguments)
53
+ if (typeof args[0] === 'object') {
54
+ args[0] = util.inspect(args[0], true, 20, true)
55
+ }
56
+ const text = util.format.apply(util, args)
57
+ this.emit('log', text)
58
+ const ret = this.pushLine(text)
59
+ if (this._clines.fake.length > this.scrollback) {
60
+ this.shiftLine(0, (this.scrollback / 3) | 0)
61
+ }
62
+ return ret
63
+ }
64
+
65
+ Log.prototype._scroll = Log.prototype.scroll
66
+ Log.prototype.scroll = function (offset, always) {
67
+ if (offset === 0) {
68
+ return this._scroll(offset, always)
69
+ }
70
+ this._userScrolled = true
71
+ const ret = this._scroll(offset, always)
72
+ if (this.getScrollPerc() === 100) {
73
+ this._userScrolled = false
74
+ }
75
+ return ret
76
+ }
77
+
78
+ /**
79
+ * Expose
80
+ */
81
+
82
+ module.exports = Log
@@ -0,0 +1,145 @@
1
+ /**
2
+ * message.js - message element for blessed
3
+ * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
4
+ * https://github.com/chjj/blessed
5
+ */
6
+
7
+ /**
8
+ * Modules
9
+ */
10
+
11
+ const Node = require('./node')
12
+ const Box = require('./box')
13
+
14
+ /**
15
+ * Message / Error
16
+ */
17
+
18
+ function Message(options) {
19
+ if (!(this instanceof Node)) {
20
+ return new Message(options)
21
+ }
22
+
23
+ options = options || {}
24
+ options.tags = true
25
+
26
+ Box.call(this, options)
27
+ }
28
+
29
+ Object.setPrototypeOf(Message.prototype, Box.prototype)
30
+
31
+ Message.prototype.type = 'message'
32
+
33
+ Message.prototype.log = Message.prototype.display = function (
34
+ text,
35
+ time,
36
+ callback
37
+ ) {
38
+ const self = this
39
+
40
+ if (typeof time === 'function') {
41
+ callback = time
42
+ time = null
43
+ }
44
+
45
+ if (time == null) {
46
+ time = 3
47
+ }
48
+
49
+ // Keep above:
50
+ // var parent = this.parent;
51
+ // this.detach();
52
+ // parent.append(this);
53
+
54
+ if (this.scrollable) {
55
+ this.screen.saveFocus()
56
+ this.focus()
57
+ this.scrollTo(0)
58
+ }
59
+
60
+ this.show()
61
+ this.setContent(text)
62
+ this.screen.render()
63
+
64
+ if (time === Infinity || time === -1 || time === 0) {
65
+ const end = function () {
66
+ if (end.done) {
67
+ return
68
+ }
69
+ end.done = true
70
+ if (self.scrollable) {
71
+ try {
72
+ self.screen.restoreFocus()
73
+ } catch (e) {}
74
+ }
75
+ self.hide()
76
+ self.screen.render()
77
+ if (callback) {
78
+ callback()
79
+ }
80
+ }
81
+
82
+ setTimeout(function () {
83
+ self.onScreenEvent('keypress', function fn(ch, key) {
84
+ if (key.name === 'mouse') {
85
+ return
86
+ }
87
+ if (self.scrollable) {
88
+ if (
89
+ key.name === 'up' ||
90
+ (self.options.vi && key.name === 'k') ||
91
+ key.name === 'down' ||
92
+ (self.options.vi && key.name === 'j') ||
93
+ (self.options.vi && key.name === 'u' && key.ctrl) ||
94
+ (self.options.vi && key.name === 'd' && key.ctrl) ||
95
+ (self.options.vi && key.name === 'b' && key.ctrl) ||
96
+ (self.options.vi && key.name === 'f' && key.ctrl) ||
97
+ (self.options.vi && key.name === 'g' && !key.shift) ||
98
+ (self.options.vi && key.name === 'g' && key.shift)
99
+ ) {
100
+ return
101
+ }
102
+ }
103
+ if (
104
+ self.options.ignoreKeys &&
105
+ ~self.options.ignoreKeys.indexOf(key.name)
106
+ ) {
107
+ return
108
+ }
109
+ self.removeScreenEvent('keypress', fn)
110
+ end()
111
+ })
112
+ // XXX May be affected by new element.options.mouse option.
113
+ if (!self.options.mouse) {
114
+ return
115
+ }
116
+ self.onScreenEvent('mouse', function fn(data) {
117
+ if (data.action === 'mousemove') {
118
+ return
119
+ }
120
+ self.removeScreenEvent('mouse', fn)
121
+ end()
122
+ })
123
+ }, 10)
124
+
125
+ return
126
+ }
127
+
128
+ setTimeout(function () {
129
+ self.hide()
130
+ self.screen.render()
131
+ if (callback) {
132
+ callback()
133
+ }
134
+ }, time * 1000)
135
+ }
136
+
137
+ Message.prototype.error = function (text, time, callback) {
138
+ return this.display('{red-fg}Error: ' + text + '{/red-fg}', time, callback)
139
+ }
140
+
141
+ /**
142
+ * Expose
143
+ */
144
+
145
+ module.exports = Message
@@ -0,0 +1,314 @@
1
+ /**
2
+ * node.js - base abstract node for blessed
3
+ * Copyright (c) 2013-2015, Christopher Jeffrey and contributors (MIT License).
4
+ * https://github.com/chjj/blessed
5
+ */
6
+
7
+ /**
8
+ * Modules
9
+ */
10
+
11
+ const EventEmitter = require('../events').EventEmitter
12
+ console.log('node_modules error', new Error().stack)
13
+ /**
14
+ * Node
15
+ */
16
+
17
+ function Node(options) {
18
+ const self = this
19
+ if (!(this instanceof Node)) {
20
+ return new Node(options)
21
+ }
22
+
23
+ EventEmitter.call(this)
24
+
25
+ options = options || {}
26
+ this.options = options
27
+
28
+ this.screen = this.screen || options.screen
29
+
30
+ if (!this.screen) {
31
+ const Screen = require('./screen')
32
+ if (this.type === 'screen') {
33
+ this.screen = this
34
+ } else if (Screen.total === 1) {
35
+ this.screen = Screen.global
36
+ } else if (options.parent) {
37
+ this.screen = options.parent
38
+ while (this.screen && this.screen.type !== 'screen') {
39
+ this.screen = this.screen.parent
40
+ }
41
+ } else if (Screen.total) {
42
+ // This _should_ work in most cases as long as the element is appended
43
+ // synchronously after the screen's creation. Throw error if not.
44
+ this.screen = Screen.instances[Screen.instances.length - 1]
45
+ process.nextTick(function () {
46
+ if (!self.parent) {
47
+ throw new Error(
48
+ 'Element (' +
49
+ self.type +
50
+ ')' +
51
+ ' was not appended synchronously after the' +
52
+ " screen's creation. Please set a `parent`" +
53
+ " or `screen` option in the element's constructor" +
54
+ ' if you are going to use multiple screens and' +
55
+ ' append the element later.'
56
+ )
57
+ }
58
+ })
59
+ } else {
60
+ console.log('node_modules error', new Error().stack)
61
+ throw new Error('No active screen okokokokoko.')
62
+ }
63
+ }
64
+
65
+ this.parent = options.parent || null
66
+ this.children = []
67
+ this.$ = this._ = this.data = {}
68
+ this.uid = Node.uid++
69
+ this.index = this.index != null ? this.index : -1
70
+
71
+ if (this.type !== 'screen') {
72
+ this.detached = true
73
+ }
74
+
75
+ if (this.parent) {
76
+ this.parent.append(this)
77
+ }
78
+
79
+ ;(options.children || []).forEach(this.append.bind(this))
80
+ }
81
+
82
+ Node.uid = 0
83
+
84
+ Object.setPrototypeOf(Node.prototype, EventEmitter.prototype)
85
+
86
+ Node.prototype.type = 'node'
87
+
88
+ Node.prototype.insert = function (element, i) {
89
+ const self = this
90
+
91
+ if (element.screen && element.screen !== this.screen) {
92
+ throw new Error("Cannot switch a node's screen.")
93
+ }
94
+
95
+ element.detach()
96
+ element.parent = this
97
+ element.screen = this.screen
98
+
99
+ if (i === 0) {
100
+ this.children.unshift(element)
101
+ } else if (i === this.children.length) {
102
+ this.children.push(element)
103
+ } else {
104
+ this.children.splice(i, 0, element)
105
+ }
106
+
107
+ element.emit('reparent', this)
108
+ this.emit('adopt', element)
109
+
110
+ ;(function emit(el) {
111
+ const n = el.detached !== self.detached
112
+ el.detached = self.detached
113
+ if (n) {
114
+ el.emit('attach')
115
+ }
116
+ el.children.forEach(emit)
117
+ })(element)
118
+
119
+ if (!this.screen.focused) {
120
+ this.screen.focused = element
121
+ }
122
+ }
123
+
124
+ Node.prototype.prepend = function (element) {
125
+ this.insert(element, 0)
126
+ }
127
+
128
+ Node.prototype.append = function (element) {
129
+ this.insert(element, this.children.length)
130
+ }
131
+
132
+ Node.prototype.insertBefore = function (element, other) {
133
+ const i = this.children.indexOf(other)
134
+ if (~i) {
135
+ this.insert(element, i)
136
+ }
137
+ }
138
+
139
+ Node.prototype.insertAfter = function (element, other) {
140
+ const i = this.children.indexOf(other)
141
+ if (~i) {
142
+ this.insert(element, i + 1)
143
+ }
144
+ }
145
+
146
+ Node.prototype.remove = function (element) {
147
+ if (element.parent !== this) {
148
+ return
149
+ }
150
+
151
+ let i = this.children.indexOf(element)
152
+ if (!~i) {
153
+ return
154
+ }
155
+
156
+ element.clearPos()
157
+
158
+ element.parent = null
159
+
160
+ this.children.splice(i, 1)
161
+
162
+ i = this.screen.clickable.indexOf(element)
163
+ if (~i) {
164
+ this.screen.clickable.splice(i, 1)
165
+ }
166
+ i = this.screen.keyable.indexOf(element)
167
+ if (~i) {
168
+ this.screen.keyable.splice(i, 1)
169
+ }
170
+
171
+ element.emit('reparent', null)
172
+ this.emit('remove', element)
173
+
174
+ ;(function emit(el) {
175
+ const n = el.detached !== true
176
+ el.detached = true
177
+ if (n) {
178
+ el.emit('detach')
179
+ }
180
+ el.children.forEach(emit)
181
+ })(element)
182
+
183
+ if (this.screen.focused === element) {
184
+ this.screen.rewindFocus()
185
+ }
186
+ }
187
+
188
+ Node.prototype.detach = function () {
189
+ if (this.parent) {
190
+ this.parent.remove(this)
191
+ }
192
+ }
193
+
194
+ Node.prototype.free = function () {
195
+ return
196
+ }
197
+
198
+ Node.prototype.destroy = function () {
199
+ this.detach()
200
+ this.forDescendants(function (el) {
201
+ el.free()
202
+ el.destroyed = true
203
+ el.emit('destroy')
204
+ }, this)
205
+ }
206
+
207
+ Node.prototype.forDescendants = function (iter, s) {
208
+ if (s) {
209
+ iter(this)
210
+ }
211
+ this.children.forEach(function emit(el) {
212
+ iter(el)
213
+ el.children.forEach(emit)
214
+ })
215
+ }
216
+
217
+ Node.prototype.forAncestors = function (iter, s) {
218
+ let el = this
219
+ if (s) {
220
+ iter(this)
221
+ }
222
+ while ((el = el.parent)) {
223
+ iter(el)
224
+ }
225
+ }
226
+
227
+ Node.prototype.collectDescendants = function (s) {
228
+ const out = []
229
+ this.forDescendants(function (el) {
230
+ out.push(el)
231
+ }, s)
232
+ return out
233
+ }
234
+
235
+ Node.prototype.collectAncestors = function (s) {
236
+ const out = []
237
+ this.forAncestors(function (el) {
238
+ out.push(el)
239
+ }, s)
240
+ return out
241
+ }
242
+
243
+ Node.prototype.emitDescendants = function () {
244
+ let args = Array.prototype.slice(arguments),
245
+ iter
246
+
247
+ if (typeof args[args.length - 1] === 'function') {
248
+ iter = args.pop()
249
+ }
250
+
251
+ return this.forDescendants(function (el) {
252
+ if (iter) {
253
+ iter(el)
254
+ }
255
+ el.emit.apply(el, args)
256
+ }, true)
257
+ }
258
+
259
+ Node.prototype.emitAncestors = function () {
260
+ let args = Array.prototype.slice(arguments),
261
+ iter
262
+
263
+ if (typeof args[args.length - 1] === 'function') {
264
+ iter = args.pop()
265
+ }
266
+
267
+ return this.forAncestors(function (el) {
268
+ if (iter) {
269
+ iter(el)
270
+ }
271
+ el.emit.apply(el, args)
272
+ }, true)
273
+ }
274
+
275
+ Node.prototype.hasDescendant = function (target) {
276
+ return (function find(el) {
277
+ for (let i = 0; i < el.children.length; i++) {
278
+ if (el.children[i] === target) {
279
+ return true
280
+ }
281
+ if (find(el.children[i]) === true) {
282
+ return true
283
+ }
284
+ }
285
+ return false
286
+ })(this)
287
+ }
288
+
289
+ Node.prototype.hasAncestor = function (target) {
290
+ let el = this
291
+ while ((el = el.parent)) {
292
+ if (el === target) {
293
+ return true
294
+ }
295
+ }
296
+ return false
297
+ }
298
+
299
+ Node.prototype.get = function (name, value) {
300
+ if (this.data.hasOwnProperty(name)) {
301
+ return this.data[name]
302
+ }
303
+ return value
304
+ }
305
+
306
+ Node.prototype.set = function (name, value) {
307
+ return (this.data[name] = value)
308
+ }
309
+
310
+ /**
311
+ * Expose
312
+ */
313
+
314
+ module.exports = Node