code
stringlengths 10
343k
| docstring
stringlengths 36
21.9k
| func_name
stringlengths 1
3.35k
| language
stringclasses 1
value | repo
stringlengths 7
58
| path
stringlengths 4
131
| url
stringlengths 44
195
| license
stringclasses 5
values |
---|---|---|---|---|---|---|---|
removeDisableMask: function () {
this.$cache.cont.remove(".irs-disable-mask");
this.$cache.cont.removeClass("irs-disabled");
}, | Then slider is not disabled
remove disable mask | removeDisableMask ( ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | Apache-2.0 |
remove: function () {
this.$cache.cont.remove();
this.$cache.cont = null;
this.$cache.line.off("keydown.irs_" + this.plugin_count);
this.$cache.body.off("touchmove.irs_" + this.plugin_count);
this.$cache.body.off("mousemove.irs_" + this.plugin_count);
this.$cache.win.off("touchend.irs_" + this.plugin_count);
this.$cache.win.off("mouseup.irs_" + this.plugin_count);
if (is_old_ie) {
this.$cache.body.off("mouseup.irs_" + this.plugin_count);
this.$cache.body.off("mouseleave.irs_" + this.plugin_count);
}
this.$cache.grid_labels = [];
this.coords.big = [];
this.coords.big_w = [];
this.coords.big_p = [];
this.coords.big_x = [];
cancelAnimationFrame(this.raf_id);
}, | Remove slider instance
and unbind all events | remove ( ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | Apache-2.0 |
pointerFocus: function (e) {
if (!this.target) {
var x;
var $handle;
if (this.options.type === "single") {
$handle = this.$cache.single;
} else {
$handle = this.$cache.from;
}
x = $handle.offset().left;
x += ($handle.width() / 2) - 1;
this.pointerClick("single", {preventDefault: function () {}, pageX: x});
}
}, | Focus with tabIndex
@param e {Object} event object | pointerFocus ( e ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | Apache-2.0 |
pointerMove: function (e) {
if (!this.dragging) {
return;
}
var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
this.coords.x_pointer = x - this.coords.x_gap;
this.calc();
}, | Mousemove or touchmove
only for handlers
@param e {Object} event object | pointerMove ( e ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | Apache-2.0 |
pointerUp: function (e) {
if (this.current_plugin !== this.plugin_count) {
return;
}
if (this.is_active) {
this.is_active = false;
} else {
return;
}
this.$cache.cont.find(".state_hover").removeClass("state_hover");
this.force_redraw = true;
if (is_old_ie) {
$("*").prop("unselectable", false);
}
this.updateScene();
this.restoreOriginalMinInterval();
// callbacks call
if ($.contains(this.$cache.cont[0], e.target) || this.dragging) {
this.callOnFinish();
}
this.dragging = false;
}, | Mouseup or touchend
only for handlers
@param e {Object} event object | pointerUp ( e ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | Apache-2.0 |
pointerDown: function (target, e) {
e.preventDefault();
var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
if (e.button === 2) {
return;
}
if (target === "both") {
this.setTempMinInterval();
}
if (!target) {
target = this.target || "from";
}
this.current_plugin = this.plugin_count;
this.target = target;
this.is_active = true;
this.dragging = true;
this.coords.x_gap = this.$cache.rs.offset().left;
this.coords.x_pointer = x - this.coords.x_gap;
this.calcPointerPercent();
this.changeLevel(target);
if (is_old_ie) {
$("*").prop("unselectable", true);
}
this.$cache.line.trigger("focus");
this.updateScene();
}, | Mousedown or touchstart
only for handlers
@param target {String|null}
@param e {Object} event object | pointerDown ( target , e ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | Apache-2.0 |
pointerClick: function (target, e) {
e.preventDefault();
var x = e.pageX || e.originalEvent.touches && e.originalEvent.touches[0].pageX;
if (e.button === 2) {
return;
}
this.current_plugin = this.plugin_count;
this.target = target;
this.is_click = true;
this.coords.x_gap = this.$cache.rs.offset().left;
this.coords.x_pointer = +(x - this.coords.x_gap).toFixed();
this.force_redraw = true;
this.calc();
this.$cache.line.trigger("focus");
}, | Mousedown or touchstart
for other slider elements, like diapason line
@param target {String}
@param e {Object} event object | pointerClick ( target , e ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | Apache-2.0 |
key: function (target, e) {
if (this.current_plugin !== this.plugin_count || e.altKey || e.ctrlKey || e.shiftKey || e.metaKey) {
return;
}
switch (e.which) {
case 83: // W
case 65: // A
case 40: // DOWN
case 37: // LEFT
e.preventDefault();
this.moveByKey(false);
break;
case 87: // S
case 68: // D
case 38: // UP
case 39: // RIGHT
e.preventDefault();
this.moveByKey(true);
break;
}
return true;
}, | Keyborard controls for focused slider
@param target {String}
@param e {Object} event object
@returns {boolean|undefined} | key ( target , e ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | Apache-2.0 |
moveByKey: function (right) {
var p = this.coords.p_pointer;
var p_step = (this.options.max - this.options.min) / 100;
p_step = this.options.step / p_step;
if (right) {
p += p_step;
} else {
p -= p_step;
}
this.coords.x_pointer = this.toFixed(this.coords.w_rs / 100 * p);
this.is_key = true;
this.calc();
}, | Move by key
@param right {boolean} direction to move | moveByKey ( right ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | Apache-2.0 |
setMinMax: function () {
if (!this.options) {
return;
}
if (this.options.hide_min_max) {
this.$cache.min[0].style.display = "none";
this.$cache.max[0].style.display = "none";
return;
}
if (this.options.values.length) {
this.$cache.min.html(this.decorate(this.options.p_values[this.options.min]));
this.$cache.max.html(this.decorate(this.options.p_values[this.options.max]));
} else {
var min_pretty = this._prettify(this.options.min);
var max_pretty = this._prettify(this.options.max);
this.result.min_pretty = min_pretty;
this.result.max_pretty = max_pretty;
this.$cache.min.html(this.decorate(min_pretty, this.options.min));
this.$cache.max.html(this.decorate(max_pretty, this.options.max));
}
this.labels.w_min = this.$cache.min.outerWidth(false);
this.labels.w_max = this.$cache.max.outerWidth(false);
}, | Set visibility and content
of Min and Max labels | setMinMax ( ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | Apache-2.0 |
setTempMinInterval: function () {
var interval = this.result.to - this.result.from;
if (this.old_min_interval === null) {
this.old_min_interval = this.options.min_interval;
}
this.options.min_interval = interval;
}, | Then dragging interval, prevent interval collapsing
using min_interval option | setTempMinInterval ( ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | Apache-2.0 |
restoreOriginalMinInterval: function () {
if (this.old_min_interval !== null) {
this.options.min_interval = this.old_min_interval;
this.old_min_interval = null;
}
}, | Restore min_interval option to original | restoreOriginalMinInterval ( ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | Apache-2.0 |
calc: function (update) {
if (!this.options) {
return;
}
this.calc_count++;
if (this.calc_count === 10 || update) {
this.calc_count = 0;
this.coords.w_rs = this.$cache.rs.outerWidth(false);
this.calcHandlePercent();
}
if (!this.coords.w_rs) {
return;
}
this.calcPointerPercent();
var handle_x = this.getHandleX();
if (this.target === "both") {
this.coords.p_gap = 0;
handle_x = this.getHandleX();
}
if (this.target === "click") {
this.coords.p_gap = this.coords.p_handle / 2;
handle_x = this.getHandleX();
if (this.options.drag_interval) {
this.target = "both_one";
} else {
this.target = this.chooseHandle(handle_x);
}
}
switch (this.target) {
case "base":
var w = (this.options.max - this.options.min) / 100,
f = (this.result.from - this.options.min) / w,
t = (this.result.to - this.options.min) / w;
this.coords.p_single_real = this.toFixed(f);
this.coords.p_from_real = this.toFixed(f);
this.coords.p_to_real = this.toFixed(t);
this.coords.p_single_real = this.checkDiapason(this.coords.p_single_real, this.options.from_min, this.options.from_max);
this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max);
this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max);
this.coords.p_single_fake = this.convertToFakePercent(this.coords.p_single_real);
this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real);
this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real);
this.target = null;
break;
case "single":
if (this.options.from_fixed) {
break;
}
this.coords.p_single_real = this.convertToRealPercent(handle_x);
this.coords.p_single_real = this.calcWithStep(this.coords.p_single_real);
this.coords.p_single_real = this.checkDiapason(this.coords.p_single_real, this.options.from_min, this.options.from_max);
this.coords.p_single_fake = this.convertToFakePercent(this.coords.p_single_real);
break;
case "from":
if (this.options.from_fixed) {
break;
}
this.coords.p_from_real = this.convertToRealPercent(handle_x);
this.coords.p_from_real = this.calcWithStep(this.coords.p_from_real);
if (this.coords.p_from_real > this.coords.p_to_real) {
this.coords.p_from_real = this.coords.p_to_real;
}
this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max);
this.coords.p_from_real = this.checkMinInterval(this.coords.p_from_real, this.coords.p_to_real, "from");
this.coords.p_from_real = this.checkMaxInterval(this.coords.p_from_real, this.coords.p_to_real, "from");
this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real);
break;
case "to":
if (this.options.to_fixed) {
break;
}
this.coords.p_to_real = this.convertToRealPercent(handle_x);
this.coords.p_to_real = this.calcWithStep(this.coords.p_to_real);
if (this.coords.p_to_real < this.coords.p_from_real) {
this.coords.p_to_real = this.coords.p_from_real;
}
this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max);
this.coords.p_to_real = this.checkMinInterval(this.coords.p_to_real, this.coords.p_from_real, "to");
this.coords.p_to_real = this.checkMaxInterval(this.coords.p_to_real, this.coords.p_from_real, "to");
this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real);
break;
case "both":
if (this.options.from_fixed || this.options.to_fixed) {
break;
}
handle_x = this.toFixed(handle_x + (this.coords.p_handle * 0.001));
this.coords.p_from_real = this.convertToRealPercent(handle_x) - this.coords.p_gap_left;
this.coords.p_from_real = this.calcWithStep(this.coords.p_from_real);
this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max);
this.coords.p_from_real = this.checkMinInterval(this.coords.p_from_real, this.coords.p_to_real, "from");
this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real);
this.coords.p_to_real = this.convertToRealPercent(handle_x) + this.coords.p_gap_right;
this.coords.p_to_real = this.calcWithStep(this.coords.p_to_real);
this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max);
this.coords.p_to_real = this.checkMinInterval(this.coords.p_to_real, this.coords.p_from_real, "to");
this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real);
break;
case "both_one":
if (this.options.from_fixed || this.options.to_fixed) {
break;
}
var real_x = this.convertToRealPercent(handle_x),
from = this.result.from_percent,
to = this.result.to_percent,
full = to - from,
half = full / 2,
new_from = real_x - half,
new_to = real_x + half;
if (new_from < 0) {
new_from = 0;
new_to = new_from + full;
}
if (new_to > 100) {
new_to = 100;
new_from = new_to - full;
}
this.coords.p_from_real = this.calcWithStep(new_from);
this.coords.p_from_real = this.checkDiapason(this.coords.p_from_real, this.options.from_min, this.options.from_max);
this.coords.p_from_fake = this.convertToFakePercent(this.coords.p_from_real);
this.coords.p_to_real = this.calcWithStep(new_to);
this.coords.p_to_real = this.checkDiapason(this.coords.p_to_real, this.options.to_min, this.options.to_max);
this.coords.p_to_fake = this.convertToFakePercent(this.coords.p_to_real);
break;
}
if (this.options.type === "single") {
this.coords.p_bar_x = (this.coords.p_handle / 2);
this.coords.p_bar_w = this.coords.p_single_fake;
this.result.from_percent = this.coords.p_single_real;
this.result.from = this.convertToValue(this.coords.p_single_real);
this.result.from_pretty = this._prettify(this.result.from);
if (this.options.values.length) {
this.result.from_value = this.options.values[this.result.from];
}
} else {
this.coords.p_bar_x = this.toFixed(this.coords.p_from_fake + (this.coords.p_handle / 2));
this.coords.p_bar_w = this.toFixed(this.coords.p_to_fake - this.coords.p_from_fake);
this.result.from_percent = this.coords.p_from_real;
this.result.from = this.convertToValue(this.coords.p_from_real);
this.result.from_pretty = this._prettify(this.result.from);
this.result.to_percent = this.coords.p_to_real;
this.result.to = this.convertToValue(this.coords.p_to_real);
this.result.to_pretty = this._prettify(this.result.to);
if (this.options.values.length) {
this.result.from_value = this.options.values[this.result.from];
this.result.to_value = this.options.values[this.result.to];
}
}
this.calcMinMax();
this.calcLabels();
}, | All calculations and measures start here
@param update {boolean=} | calc ( update ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | Apache-2.0 |
chooseHandle: function (real_x) {
if (this.options.type === "single") {
return "single";
} else {
var m_point = this.coords.p_from_real + ((this.coords.p_to_real - this.coords.p_from_real) / 2);
if (real_x >= m_point) {
return this.options.to_fixed ? "from" : "to";
} else {
return this.options.from_fixed ? "to" : "from";
}
}
}, | Find closest handle to pointer click
@param real_x {Number}
@returns {String} | chooseHandle ( real_x ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | Apache-2.0 |
calcMinMax: function () {
if (!this.coords.w_rs) {
return;
}
this.labels.p_min = this.labels.w_min / this.coords.w_rs * 100;
this.labels.p_max = this.labels.w_max / this.coords.w_rs * 100;
}, | Measure Min and Max labels width in percent | calcMinMax ( ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | Apache-2.0 |
calcLabels: function () {
if (!this.coords.w_rs || this.options.hide_from_to) {
return;
}
if (this.options.type === "single") {
this.labels.w_single = this.$cache.single.outerWidth(false);
this.labels.p_single_fake = this.labels.w_single / this.coords.w_rs * 100;
this.labels.p_single_left = this.coords.p_single_fake + (this.coords.p_handle / 2) - (this.labels.p_single_fake / 2);
this.labels.p_single_left = this.checkEdges(this.labels.p_single_left, this.labels.p_single_fake);
} else {
this.labels.w_from = this.$cache.from.outerWidth(false);
this.labels.p_from_fake = this.labels.w_from / this.coords.w_rs * 100;
this.labels.p_from_left = this.coords.p_from_fake + (this.coords.p_handle / 2) - (this.labels.p_from_fake / 2);
this.labels.p_from_left = this.toFixed(this.labels.p_from_left);
this.labels.p_from_left = this.checkEdges(this.labels.p_from_left, this.labels.p_from_fake);
this.labels.w_to = this.$cache.to.outerWidth(false);
this.labels.p_to_fake = this.labels.w_to / this.coords.w_rs * 100;
this.labels.p_to_left = this.coords.p_to_fake + (this.coords.p_handle / 2) - (this.labels.p_to_fake / 2);
this.labels.p_to_left = this.toFixed(this.labels.p_to_left);
this.labels.p_to_left = this.checkEdges(this.labels.p_to_left, this.labels.p_to_fake);
this.labels.w_single = this.$cache.single.outerWidth(false);
this.labels.p_single_fake = this.labels.w_single / this.coords.w_rs * 100;
this.labels.p_single_left = ((this.labels.p_from_left + this.labels.p_to_left + this.labels.p_to_fake) / 2) - (this.labels.p_single_fake / 2);
this.labels.p_single_left = this.toFixed(this.labels.p_single_left);
this.labels.p_single_left = this.checkEdges(this.labels.p_single_left, this.labels.p_single_fake);
}
}, | Measure labels width and X in percent | calcLabels ( ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | Apache-2.0 |
updateScene: function () {
if (this.raf_id) {
cancelAnimationFrame(this.raf_id);
this.raf_id = null;
}
clearTimeout(this.update_tm);
this.update_tm = null;
if (!this.options) {
return;
}
this.drawHandles();
if (this.is_active) {
this.raf_id = requestAnimationFrame(this.updateScene.bind(this));
} else {
this.update_tm = setTimeout(this.updateScene.bind(this), 300);
}
}, | Main function called in request animation frame
to update everything | updateScene ( ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | Apache-2.0 |
drawLabels: function () {
if (!this.options) {
return;
}
var values_num = this.options.values.length;
var p_values = this.options.p_values;
var text_single;
var text_from;
var text_to;
var from_pretty;
var to_pretty;
if (this.options.hide_from_to) {
return;
}
if (this.options.type === "single") {
if (values_num) {
text_single = this.decorate(p_values[this.result.from]);
this.$cache.single.html(text_single);
} else {
from_pretty = this._prettify(this.result.from);
text_single = this.decorate(from_pretty, this.result.from);
this.$cache.single.html(text_single);
}
this.calcLabels();
if (this.labels.p_single_left < this.labels.p_min + 1) {
this.$cache.min[0].style.visibility = "hidden";
} else {
this.$cache.min[0].style.visibility = "visible";
}
if (this.labels.p_single_left + this.labels.p_single_fake > 100 - this.labels.p_max - 1) {
this.$cache.max[0].style.visibility = "hidden";
} else {
this.$cache.max[0].style.visibility = "visible";
}
} else {
if (values_num) {
if (this.options.decorate_both) {
text_single = this.decorate(p_values[this.result.from]);
text_single += this.options.values_separator;
text_single += this.decorate(p_values[this.result.to]);
} else {
text_single = this.decorate(p_values[this.result.from] + this.options.values_separator + p_values[this.result.to]);
}
text_from = this.decorate(p_values[this.result.from]);
text_to = this.decorate(p_values[this.result.to]);
this.$cache.single.html(text_single);
this.$cache.from.html(text_from);
this.$cache.to.html(text_to);
} else {
from_pretty = this._prettify(this.result.from);
to_pretty = this._prettify(this.result.to);
if (this.options.decorate_both) {
text_single = this.decorate(from_pretty, this.result.from);
text_single += this.options.values_separator;
text_single += this.decorate(to_pretty, this.result.to);
} else {
text_single = this.decorate(from_pretty + this.options.values_separator + to_pretty, this.result.to);
}
text_from = this.decorate(from_pretty, this.result.from);
text_to = this.decorate(to_pretty, this.result.to);
this.$cache.single.html(text_single);
this.$cache.from.html(text_from);
this.$cache.to.html(text_to);
}
this.calcLabels();
var min = Math.min(this.labels.p_single_left, this.labels.p_from_left),
single_left = this.labels.p_single_left + this.labels.p_single_fake,
to_left = this.labels.p_to_left + this.labels.p_to_fake,
max = Math.max(single_left, to_left);
if (this.labels.p_from_left + this.labels.p_from_fake >= this.labels.p_to_left) {
this.$cache.from[0].style.visibility = "hidden";
this.$cache.to[0].style.visibility = "hidden";
this.$cache.single[0].style.visibility = "visible";
if (this.result.from === this.result.to) {
if (this.target === "from") {
this.$cache.from[0].style.visibility = "visible";
} else if (this.target === "to") {
this.$cache.to[0].style.visibility = "visible";
} else if (!this.target) {
this.$cache.from[0].style.visibility = "visible";
}
this.$cache.single[0].style.visibility = "hidden";
max = to_left;
} else {
this.$cache.from[0].style.visibility = "hidden";
this.$cache.to[0].style.visibility = "hidden";
this.$cache.single[0].style.visibility = "visible";
max = Math.max(single_left, to_left);
}
} else {
this.$cache.from[0].style.visibility = "visible";
this.$cache.to[0].style.visibility = "visible";
this.$cache.single[0].style.visibility = "hidden";
}
if (min < this.labels.p_min + 1) {
this.$cache.min[0].style.visibility = "hidden";
} else {
this.$cache.min[0].style.visibility = "visible";
}
if (max > 100 - this.labels.p_max - 1) {
this.$cache.max[0].style.visibility = "hidden";
} else {
this.$cache.max[0].style.visibility = "visible";
}
}
}, | Draw labels
measure labels collisions
collapse close labels | drawLabels ( ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/ion-rangeslider/js/ion.rangeSlider.js | Apache-2.0 |
function comparativeDistance(x, y) {
return (
Math.pow(x[0] - y[0], 2) +
Math.pow(x[1] - y[1], 2) +
Math.pow(x[2] - y[2], 2)
);
} | See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance
* | comparativeDistance ( x , y ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
mix: function (mixinColor, weight) {
var color1 = this;
var color2 = mixinColor;
var p = weight === undefined ? 0.5 : weight;
var w = 2 * p - 1;
var a = color1.alpha() - color2.alpha();
var w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
var w2 = 1 - w1;
return this
.rgb(
w1 * color1.red() + w2 * color2.red(),
w1 * color1.green() + w2 * color2.green(),
w1 * color1.blue() + w2 * color2.blue()
)
.alpha(color1.alpha() * p + color2.alpha() * (1 - p));
}, | Ported from sass implementation in C
https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209 | mix ( mixinColor , weight ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
noop: function() {}, | An empty function that can be used, for example, for optional callback. | noop ( ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
uid: (function() {
var id = 0;
return function() {
return id++;
};
}()), | Returns a unique id, sequentially generated from a global variable.
@returns {number}
@function | uid ( function ( ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
helpers.indexOf = function(array, item, fromIndex) {
return Array.prototype.indexOf.call(array, item, fromIndex);
}; | Provided for backward compatibility, use Array.prototype.indexOf instead.
Array.prototype.indexOf compatibility: Chrome, Opera, Safari, FF1.5+, IE9+
@function Chart.helpers.indexOf
@deprecated since version 2.7.0
@todo remove at version 3
@private | helpers.indexOf ( array , item , fromIndex ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
clear: function(chart) {
chart.ctx.clearRect(0, 0, chart.width, chart.height);
}, | Clears the entire canvas associated to the given `chart`.
@param {Chart} chart - The chart for which to clear the canvas. | clear ( chart ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
roundedRect: function(ctx, x, y, width, height, radius) {
if (radius) {
var r = Math.min(radius, height / 2, width / 2);
var left = x + r;
var top = y + r;
var right = x + width - r;
var bottom = y + height - r;
ctx.moveTo(x, top);
if (left < right && top < bottom) {
ctx.arc(left, top, r, -PI, -HALF_PI);
ctx.arc(right, top, r, -HALF_PI, 0);
ctx.arc(right, bottom, r, 0, HALF_PI);
ctx.arc(left, bottom, r, HALF_PI, PI);
} else if (left < right) {
ctx.moveTo(left, y);
ctx.arc(right, top, r, -HALF_PI, HALF_PI);
ctx.arc(left, top, r, HALF_PI, PI + HALF_PI);
} else if (top < bottom) {
ctx.arc(left, top, r, -PI, 0);
ctx.arc(left, bottom, r, 0, PI);
} else {
ctx.arc(left, top, r, -PI, PI);
}
ctx.closePath();
ctx.moveTo(x, y);
} else {
ctx.rect(x, y, width, height);
}
}, | Creates a "path" for a rectangle with rounded corners at position (x, y) with a
given size (width, height) and the same `radius` for all corners.
@param {CanvasRenderingContext2D} ctx - The canvas 2D Context.
@param {number} x - The x axis of the coordinate for the rectangle starting point.
@param {number} y - The y axis of the coordinate for the rectangle starting point.
@param {number} width - The rectangle's width.
@param {number} height - The rectangle's height.
@param {number} radius - The rounded amount (in pixels) for the four corners.
@todo handle `radius` as top-left, top-right, bottom-right, bottom-left array/object? | roundedRect ( ctx , x , y , width , height , radius ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
_isPointInArea: function(point, area) {
var epsilon = 1e-6; // 1e-6 is margin in pixels for accumulated error.
return point.x > area.left - epsilon && point.x < area.right + epsilon &&
point.y > area.top - epsilon && point.y < area.bottom + epsilon;
}, | Returns true if the point is inside the rectangle
@param {object} point - The point to test
@param {object} area - The rectangle
@returns {boolean}
@private | _isPointInArea ( point , area ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
helpers_core.drawRoundedRectangle = function(ctx) {
ctx.beginPath();
exports$1.roundedRect.apply(exports$1, arguments);
}; | Provided for backward compatibility, use Chart.helpers.canvas.roundedRect instead.
@namespace Chart.helpers.drawRoundedRectangle
@deprecated since version 2.7.0
@todo remove at version 3
@private | helpers_core.drawRoundedRectangle ( ctx ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
resolve: function(inputs, context, index, info) {
var cacheable = true;
var i, ilen, value;
for (i = 0, ilen = inputs.length; i < ilen; ++i) {
value = inputs[i];
if (value === undefined) {
continue;
}
if (context !== undefined && typeof value === 'function') {
value = value(context);
cacheable = false;
}
if (index !== undefined && helpers_core.isArray(value)) {
value = value[index];
cacheable = false;
}
if (value !== undefined) {
if (info && !cacheable) {
info.cacheable = false;
}
return value;
}
}
} | Evaluates the given `inputs` sequentially and returns the first defined value.
@param {Array} inputs - An array of values, falling back to the last value.
@param {object} [context] - If defined and the current value is a function, the value
is called with `context` as first argument and the result becomes the new input.
@param {number} [index] - If defined and the current value is an array, the value
at `index` become the new input.
@param {object} [info] - object to return information about resolution in
@param {boolean} [info.cacheable] - Will be set to `false` if option is not cacheable.
@since 2.7.0 | resolve ( inputs , context , index , info ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
_factorize: function(value) {
var result = [];
var sqrt = Math.sqrt(value);
var i;
for (i = 1; i < sqrt; i++) {
if (value % i === 0) {
result.push(i);
result.push(value / i);
}
}
if (sqrt === (sqrt | 0)) { // if value is a square number
result.push(sqrt);
}
result.sort(function(a, b) {
return a - b;
}).pop();
return result;
}, | Returns an array of factors sorted from 1 to sqrt(value)
@private | _factorize ( value ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
addAnimation: function(chart, animation, duration, lazy) {
var animations = this.animations;
var i, ilen;
animation.chart = chart;
animation.startTime = Date.now();
animation.duration = duration;
if (!lazy) {
chart.animating = true;
}
for (i = 0, ilen = animations.length; i < ilen; ++i) {
if (animations[i].chart === chart) {
animations[i] = animation;
return;
}
}
animations.push(animation);
// If there are no animations queued, manually kickstart a digest, for lack of a better word
if (animations.length === 1) {
this.requestAnimationFrame();
}
}, | @param {Chart} chart - The chart to animate.
@param {Chart.Animation} animation - The animation that we will animate.
@param {number} duration - The animation duration in ms.
@param {boolean} lazy - if true, the chart is not marked as animating to enable more responsive interactions | addAnimation ( chart , animation , duration , lazy ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
function listenArrayEvents(array, listener) {
if (array._chartjs) {
array._chartjs.listeners.push(listener);
return;
}
Object.defineProperty(array, '_chartjs', {
configurable: true,
enumerable: false,
value: {
listeners: [listener]
}
});
arrayEvents.forEach(function(key) {
var method = 'onData' + key.charAt(0).toUpperCase() + key.slice(1);
var base = array[key];
Object.defineProperty(array, key, {
configurable: true,
enumerable: false,
value: function() {
var args = Array.prototype.slice.call(arguments);
var res = base.apply(this, args);
helpers$1.each(array._chartjs.listeners, function(object) {
if (typeof object[method] === 'function') {
object[method].apply(object, args);
}
});
return res;
}
});
});
} | Hooks the array methods that add or remove values ('push', pop', 'shift', 'splice',
'unshift') and notify the listener AFTER the array has been altered. Listeners are
called on the 'onData*' callbacks (e.g. onDataPush, etc.) with same arguments. | listenArrayEvents ( array , listener ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
function unlistenArrayEvents(array, listener) {
var stub = array._chartjs;
if (!stub) {
return;
}
var listeners = stub.listeners;
var index = listeners.indexOf(listener);
if (index !== -1) {
listeners.splice(index, 1);
}
if (listeners.length > 0) {
return;
}
arrayEvents.forEach(function(key) {
delete array[key];
});
delete array._chartjs;
} | Removes the given array event listener and cleanup extra attached properties (such as
the _chartjs stub and overridden methods) if array doesn't have any more listeners. | unlistenArrayEvents ( array , listener ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
_configure: function() {
var me = this;
me._config = helpers$1.merge({}, [
me.chart.options.datasets[me._type],
me.getDataset(),
], {
merger: function(key, target, source) {
if (key !== '_meta' && key !== 'data') {
helpers$1._merger(key, target, source);
}
}
});
}, | Returns the merged user-supplied and default dataset-level options
@private | _configure ( ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
getStyle: function(index) {
var me = this;
var meta = me.getMeta();
var dataset = meta.dataset;
var style;
me._configure();
if (dataset && index === undefined) {
style = me._resolveDatasetElementOptions(dataset || {});
} else {
index = index || 0;
style = me._resolveDataElementOptions(meta.data[index] || {}, index);
}
if (style.fill === false || style.fill === null) {
style.backgroundColor = style.borderColor;
}
return style;
}, | Returns a set of predefined style properties that should be used to represent the dataset
or the data if the index is specified
@param {number} index - data index
@return {IStyleInterface} style object | getStyle ( index ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
function getBarBounds(vm) {
var x1, x2, y1, y2, half;
if (isVertical(vm)) {
half = vm.width / 2;
x1 = vm.x - half;
x2 = vm.x + half;
y1 = Math.min(vm.y, vm.base);
y2 = Math.max(vm.y, vm.base);
} else {
half = vm.height / 2;
x1 = Math.min(vm.x, vm.base);
x2 = Math.max(vm.x, vm.base);
y1 = vm.y - half;
y2 = vm.y + half;
}
return {
left: x1,
top: y1,
right: x2,
bottom: y2
};
} | Helper function to get the bounds of the bar regardless of the orientation
@param bar {Chart.Element.Rectangle} the bar
@return {Bounds} bounds of the bar
@private | getBarBounds ( vm ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
function computeMinSampleSize(scale, pixels) {
var min = scale._length;
var prev, curr, i, ilen;
for (i = 1, ilen = pixels.length; i < ilen; ++i) {
min = Math.min(min, Math.abs(pixels[i] - pixels[i - 1]));
}
for (i = 0, ilen = scale.getTicks().length; i < ilen; ++i) {
curr = scale.getPixelForTick(i);
min = i > 0 ? Math.min(min, Math.abs(curr - prev)) : min;
prev = curr;
}
return min;
} | Computes the "optimal" sample size to maintain bars equally sized while preventing overlap.
@private | computeMinSampleSize ( scale , pixels ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
_getStacks: function(last) {
var me = this;
var scale = me._getIndexScale();
var metasets = scale._getMatchingVisibleMetas(me._type);
var stacked = scale.options.stacked;
var ilen = metasets.length;
var stacks = [];
var i, meta;
for (i = 0; i < ilen; ++i) {
meta = metasets[i];
// stacked | meta.stack
// | found | not found | undefined
// false | x | x | x
// true | | x |
// undefined | | x | x
if (stacked === false || stacks.indexOf(meta.stack) === -1 ||
(stacked === undefined && meta.stack === undefined)) {
stacks.push(meta.stack);
}
if (meta.index === last) {
break;
}
}
return stacks;
}, | Returns the stacks based on groups and bar visibility.
@param {number} [last] - The dataset index
@returns {string[]} The list of stack IDs
@private | _getStacks ( last ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
getStackCount: function() {
return this._getStacks().length;
}, | Returns the effective number of stacks based on groups and bar visibility.
@private | getStackCount ( ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
getStackIndex: function(datasetIndex, name) {
var stacks = this._getStacks(datasetIndex);
var index = (name !== undefined)
? stacks.indexOf(name)
: -1; // indexOf returns -1 if element is not present
return (index === -1)
? stacks.length - 1
: index;
}, | Returns the stack index for the given dataset based on groups and bar visibility.
@param {number} [datasetIndex] - The dataset index
@param {string} [name] - The stack name to find
@returns {number} The stack index
@private | getStackIndex ( datasetIndex , name ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
calculateBarValuePixels: function(datasetIndex, index, options) {
var me = this;
var chart = me.chart;
var scale = me._getValueScale();
var isHorizontal = scale.isHorizontal();
var datasets = chart.data.datasets;
var metasets = scale._getMatchingVisibleMetas(me._type);
var value = scale._parseValue(datasets[datasetIndex].data[index]);
var minBarLength = options.minBarLength;
var stacked = scale.options.stacked;
var stack = me.getMeta().stack;
var start = value.start === undefined ? 0 : value.max >= 0 && value.min >= 0 ? value.min : value.max;
var length = value.start === undefined ? value.end : value.max >= 0 && value.min >= 0 ? value.max - value.min : value.min - value.max;
var ilen = metasets.length;
var i, imeta, ivalue, base, head, size, stackLength;
if (stacked || (stacked === undefined && stack !== undefined)) {
for (i = 0; i < ilen; ++i) {
imeta = metasets[i];
if (imeta.index === datasetIndex) {
break;
}
if (imeta.stack === stack) {
stackLength = scale._parseValue(datasets[imeta.index].data[index]);
ivalue = stackLength.start === undefined ? stackLength.end : stackLength.min >= 0 && stackLength.max >= 0 ? stackLength.max : stackLength.min;
if ((value.min < 0 && ivalue < 0) || (value.max >= 0 && ivalue > 0)) {
start += ivalue;
}
}
}
}
base = scale.getPixelForValue(start);
head = scale.getPixelForValue(start + length);
size = head - base;
if (minBarLength !== undefined && Math.abs(size) < minBarLength) {
size = minBarLength;
if (length >= 0 && !isHorizontal || length < 0 && isHorizontal) {
head = base - minBarLength;
} else {
head = base + minBarLength;
}
}
return {
size: size,
base: base,
head: head,
center: head + size / 2
};
}, | Note: pixel values are not clamped to the scale area.
@private | calculateBarValuePixels ( datasetIndex , index , options ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/chart.js/Chart.js | Apache-2.0 |
function eifelerRegelAppliesToNumber(number) {
number = parseInt(number, 10);
if (isNaN(number)) {
return false;
}
if (number < 0) {
// Negative Number --> always true
return true;
} else if (number < 10) {
// Only 1 digit
if (4 <= number && number <= 7) {
return true;
}
return false;
} else if (number < 100) {
// 2 digits
var lastDigit = number % 10, firstDigit = number / 10;
if (lastDigit === 0) {
return eifelerRegelAppliesToNumber(firstDigit);
}
return eifelerRegelAppliesToNumber(lastDigit);
} else if (number < 10000) {
// 3 or 4 digits --> recursively check first digit
while (number >= 10) {
number = number / 10;
}
return eifelerRegelAppliesToNumber(number);
} else {
// Anything larger than 4 digits: recursively check first n-3 digits
number = number / 1000;
return eifelerRegelAppliesToNumber(number);
}
} | Returns true if the word before the given number loses the '-n' ending.
e.g. 'an 10 Deeg' but 'a 5 Deeg'
@param number {integer}
@returns {boolean} | eifelerRegelAppliesToNumber ( number ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/moment/locale/lb.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/moment/locale/lb.js | Apache-2.0 |
function format(forms, number, withoutSuffix) {
if (withoutSuffix) {
// E.g. "21 minūte", "3 minūtes".
return number % 10 === 1 && number % 100 !== 11 ? forms[2] : forms[3];
} else {
// E.g. "21 minūtes" as in "pēc 21 minūtes".
// E.g. "3 minūtēm" as in "pēc 3 minūtēm".
return number % 10 === 1 && number % 100 !== 11 ? forms[0] : forms[1];
}
} | @param withoutSuffix boolean true = a length of time; false = before/after a period of time. | format ( forms , number , withoutSuffix ) | javascript | Xabaril/Esquio | src/Esquio.UI.Client/wwwroot/plugins/moment/locale/lv.js | https://github.com/Xabaril/Esquio/blob/master/src/Esquio.UI.Client/wwwroot/plugins/moment/locale/lv.js | Apache-2.0 |
function getDataType(data) {
if (data === null) {
return 'null';
} else if (data === undefined) {
return 'undefined';
}
if (Object(react_is__WEBPACK_IMPORTED_MODULE_1__["isElement"])(data)) {
return 'react_element';
}
if (typeof HTMLElement !== 'undefined' && data instanceof HTMLElement) {
return 'html_element';
}
const type = typeof data;
switch (type) {
case 'bigint':
return 'bigint';
case 'boolean':
return 'boolean';
case 'function':
return 'function';
case 'number':
if (Number.isNaN(data)) {
return 'nan';
} else if (!Number.isFinite(data)) {
return 'infinity';
} else {
return 'number';
}
case 'object':
if (Object(_isArray__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])(data)) {
return 'array';
} else if (ArrayBuffer.isView(data)) {
return hasOwnProperty.call(data.constructor, 'BYTES_PER_ELEMENT') ? 'typed_array' : 'data_view';
} else if (data.constructor && data.constructor.name === 'ArrayBuffer') {
// HACK This ArrayBuffer check is gross; is there a better way?
// We could try to create a new DataView with the value.
// If it doesn't error, we know it's an ArrayBuffer,
// but this seems kind of awkward and expensive.
return 'array_buffer';
} else if (typeof data[Symbol.iterator] === 'function') {
const iterator = data[Symbol.iterator]();
if (!iterator) {// Proxies might break assumptoins about iterators.
// See github.com/facebook/react/issues/21654
} else {
return iterator === data ? 'opaque_iterator' : 'iterator';
}
} else if (data.constructor && data.constructor.name === 'RegExp') {
return 'regexp';
} else {
// $FlowFixMe[method-unbinding]
const toStringValue = Object.prototype.toString.call(data);
if (toStringValue === '[object Date]') {
return 'date';
} else if (toStringValue === '[object HTMLAllCollection]') {
return 'html_all_collection';
}
}
return 'object';
case 'string':
return 'string';
case 'symbol':
return 'symbol';
case 'undefined':
if ( // $FlowFixMe[method-unbinding]
Object.prototype.toString.call(data) === '[object HTMLAllCollection]') {
return 'html_all_collection';
}
return 'undefined';
default:
return 'unknown';
}
} | Get a enhanced/artificial type string based on the object instance | getDataType ( data ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/react_devtools_backend.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/react_devtools_backend.js | MIT |
function cleanForBridge(data, isPathAllowed, path = []) {
if (data !== null) {
const cleanedPaths = [];
const unserializablePaths = [];
const cleanedData = Object(_hydration__WEBPACK_IMPORTED_MODULE_1__[/* dehydrate */ "a"])(data, cleanedPaths, unserializablePaths, path, isPathAllowed);
return {
data: cleanedData,
cleaned: cleanedPaths,
unserializable: unserializablePaths
};
} else {
return null;
}
} | Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree. | cleanForBridge ( data , isPathAllowed , path = [ ] ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/react_devtools_backend.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/react_devtools_backend.js | MIT |
var now = function () {
return root.Date.now();
}; | Gets the timestamp of the number of milliseconds that have elapsed since
the Unix epoch (1 January 1970 00:00:00 UTC).
@static
@memberOf _
@since 2.4.0
@category Date
@returns {number} Returns the timestamp.
@example
_.defer(function(stamp) {
console.log(_.now() - stamp);
}, _.now());
// => Logs the number of milliseconds it took for the deferred invocation. | now ( ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/react_devtools_backend.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/react_devtools_backend.js | MIT |
function debounce(func, wait, options) {
var lastArgs,
lastThis,
maxWait,
result,
timerId,
lastCallTime,
lastInvokeTime = 0,
leading = false,
maxing = false,
trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
wait = toNumber(wait) || 0;
if (isObject(options)) {
leading = !!options.leading;
maxing = 'maxWait' in options;
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
trailing = 'trailing' in options ? !!options.trailing : trailing;
}
function invokeFunc(time) {
var args = lastArgs,
thisArg = lastThis;
lastArgs = lastThis = undefined;
lastInvokeTime = time;
result = func.apply(thisArg, args);
return result;
}
function leadingEdge(time) {
// Reset any `maxWait` timer.
lastInvokeTime = time; // Start the timer for the trailing edge.
timerId = setTimeout(timerExpired, wait); // Invoke the leading edge.
return leading ? invokeFunc(time) : result;
}
function remainingWait(time) {
var timeSinceLastCall = time - lastCallTime,
timeSinceLastInvoke = time - lastInvokeTime,
result = wait - timeSinceLastCall;
return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
}
function shouldInvoke(time) {
var timeSinceLastCall = time - lastCallTime,
timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the
// trailing edge, the system time has gone backwards and we're treating
// it as the trailing edge, or we've hit the `maxWait` limit.
return lastCallTime === undefined || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
}
function timerExpired() {
var time = now();
if (shouldInvoke(time)) {
return trailingEdge(time);
} // Restart the timer.
timerId = setTimeout(timerExpired, remainingWait(time));
}
function trailingEdge(time) {
timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been
// debounced at least once.
if (trailing && lastArgs) {
return invokeFunc(time);
}
lastArgs = lastThis = undefined;
return result;
}
function cancel() {
if (timerId !== undefined) {
clearTimeout(timerId);
}
lastInvokeTime = 0;
lastArgs = lastCallTime = lastThis = timerId = undefined;
}
function flush() {
return timerId === undefined ? result : trailingEdge(now());
}
function debounced() {
var time = now(),
isInvoking = shouldInvoke(time);
lastArgs = arguments;
lastThis = this;
lastCallTime = time;
if (isInvoking) {
if (timerId === undefined) {
return leadingEdge(lastCallTime);
}
if (maxing) {
// Handle invocations in a tight loop.
timerId = setTimeout(timerExpired, wait);
return invokeFunc(lastCallTime);
}
}
if (timerId === undefined) {
timerId = setTimeout(timerExpired, wait);
}
return result;
}
debounced.cancel = cancel;
debounced.flush = flush;
return debounced;
} | Creates a debounced function that delays invoking `func` until after `wait`
milliseconds have elapsed since the last time the debounced function was
invoked. The debounced function comes with a `cancel` method to cancel
delayed `func` invocations and a `flush` method to immediately invoke them.
Provide `options` to indicate whether `func` should be invoked on the
leading and/or trailing edge of the `wait` timeout. The `func` is invoked
with the last arguments provided to the debounced function. Subsequent
calls to the debounced function return the result of the last `func`
invocation.
**Note:** If `leading` and `trailing` options are `true`, `func` is
invoked on the trailing edge of the timeout only if the debounced function
is invoked more than once during the `wait` timeout.
If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
until to the next tick, similar to `setTimeout` with a timeout of `0`.
See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
for details over the differences between `_.debounce` and `_.throttle`.
@static
@memberOf _
@since 0.1.0
@category Function
@param {Function} func The function to debounce.
@param {number} [wait=0] The number of milliseconds to delay.
@param {Object} [options={}] The options object.
@param {boolean} [options.leading=false]
Specify invoking on the leading edge of the timeout.
@param {number} [options.maxWait]
The maximum time `func` is allowed to be delayed before it's invoked.
@param {boolean} [options.trailing=true]
Specify invoking on the trailing edge of the timeout.
@returns {Function} Returns the new debounced function.
@example
// Avoid costly calculations while the window size is in flux.
jQuery(window).on('resize', _.debounce(calculateLayout, 150));
// Invoke `sendMail` when clicked, debouncing subsequent calls.
jQuery(element).on('click', _.debounce(sendMail, 300, {
'leading': true,
'trailing': false
}));
// Ensure `batchLog` is invoked once after 1 second of debounced calls.
var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
var source = new EventSource('/stream');
jQuery(source).on('message', debounced);
// Cancel the trailing debounced invocation.
jQuery(window).on('popstate', debounced.cancel); | debounce ( func , wait , options ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/react_devtools_backend.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/react_devtools_backend.js | MIT |
function throttle(func, wait, options) {
var leading = true,
trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (isObject(options)) {
leading = 'leading' in options ? !!options.leading : leading;
trailing = 'trailing' in options ? !!options.trailing : trailing;
}
return debounce(func, wait, {
'leading': leading,
'maxWait': wait,
'trailing': trailing
});
} | Creates a throttled function that only invokes `func` at most once per
every `wait` milliseconds. The throttled function comes with a `cancel`
method to cancel delayed `func` invocations and a `flush` method to
immediately invoke them. Provide `options` to indicate whether `func`
should be invoked on the leading and/or trailing edge of the `wait`
timeout. The `func` is invoked with the last arguments provided to the
throttled function. Subsequent calls to the throttled function return the
result of the last `func` invocation.
**Note:** If `leading` and `trailing` options are `true`, `func` is
invoked on the trailing edge of the timeout only if the throttled function
is invoked more than once during the `wait` timeout.
If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
until to the next tick, similar to `setTimeout` with a timeout of `0`.
See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
for details over the differences between `_.throttle` and `_.debounce`.
@static
@memberOf _
@since 0.1.0
@category Function
@param {Function} func The function to throttle.
@param {number} [wait=0] The number of milliseconds to throttle invocations to.
@param {Object} [options={}] The options object.
@param {boolean} [options.leading=true]
Specify invoking on the leading edge of the timeout.
@param {boolean} [options.trailing=true]
Specify invoking on the trailing edge of the timeout.
@returns {Function} Returns the new throttled function.
@example
// Avoid excessively updating the position while scrolling.
jQuery(window).on('scroll', _.throttle(updatePosition, 100));
// Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
jQuery(element).on('click', throttled);
// Cancel the trailing throttled invocation.
jQuery(window).on('popstate', throttled.cancel); | throttle ( func , wait , options ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/react_devtools_backend.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/react_devtools_backend.js | MIT |
function isSymbol(value) {
return typeof value == 'symbol' || isObjectLike(value) && objectToString.call(value) == symbolTag;
} | Checks if `value` is classified as a `Symbol` primitive or object.
@static
@memberOf _
@since 4.0.0
@category Lang
@param {*} value The value to check.
@returns {boolean} Returns `true` if `value` is a symbol, else `false`.
@example
_.isSymbol(Symbol.iterator);
// => true
_.isSymbol('abc');
// => false | isSymbol ( value ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/react_devtools_backend.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/react_devtools_backend.js | MIT |
function toNumber(value) {
if (typeof value == 'number') {
return value;
}
if (isSymbol(value)) {
return NAN;
}
if (isObject(value)) {
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
value = isObject(other) ? other + '' : other;
}
if (typeof value != 'string') {
return value === 0 ? value : +value;
}
value = value.replace(reTrim, '');
var isBinary = reIsBinary.test(value);
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
}
module.exports = throttle;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(20))) | Converts `value` to a number.
@static
@memberOf _
@since 4.0.0
@category Lang
@param {*} value The value to process.
@returns {number} Returns the number.
@example
_.toNumber(3.2);
// => 3.2
_.toNumber(Number.MIN_VALUE);
// => 5e-324
_.toNumber(Infinity);
// => Infinity
_.toNumber('3.2');
// => 3.2 | toNumber ( value ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/react_devtools_backend.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/react_devtools_backend.js | MIT |
function is(x, y) {
return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare
;
} | inlined Object.is polyfill to avoid requiring consumers ship their own
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is | is ( x , y ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/react_devtools_backend.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/react_devtools_backend.js | MIT |
function resolveBoxStyle(prefix, style) {
let hasParts = false;
const result = {
bottom: 0,
left: 0,
right: 0,
top: 0
};
const styleForAll = style[prefix];
if (styleForAll != null) {
// eslint-disable-next-line no-for-of-loops/no-for-of-loops
for (const key of Object.keys(result)) {
result[key] = styleForAll;
}
hasParts = true;
}
const styleForHorizontal = style[prefix + 'Horizontal'];
if (styleForHorizontal != null) {
result.left = styleForHorizontal;
result.right = styleForHorizontal;
hasParts = true;
} else {
const styleForLeft = style[prefix + 'Left'];
if (styleForLeft != null) {
result.left = styleForLeft;
hasParts = true;
}
const styleForRight = style[prefix + 'Right'];
if (styleForRight != null) {
result.right = styleForRight;
hasParts = true;
}
const styleForEnd = style[prefix + 'End'];
if (styleForEnd != null) {
// TODO RTL support
result.right = styleForEnd;
hasParts = true;
}
const styleForStart = style[prefix + 'Start'];
if (styleForStart != null) {
// TODO RTL support
result.left = styleForStart;
hasParts = true;
}
}
const styleForVertical = style[prefix + 'Vertical'];
if (styleForVertical != null) {
result.bottom = styleForVertical;
result.top = styleForVertical;
hasParts = true;
} else {
const styleForBottom = style[prefix + 'Bottom'];
if (styleForBottom != null) {
result.bottom = styleForBottom;
hasParts = true;
}
const styleForTop = style[prefix + 'Top'];
if (styleForTop != null) {
result.top = styleForTop;
hasParts = true;
}
}
return hasParts ? result : null;
} | This mirrors react-native/Libraries/Inspector/resolveBoxStyle.js (but without RTL support).
Resolve a style property into it's component parts, e.g.
resolveBoxStyle('margin', {margin: 5, marginBottom: 10})
-> {top: 5, left: 5, right: 5, bottom: 10} | resolveBoxStyle ( prefix , style ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/react_devtools_backend.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/react_devtools_backend.js | MIT |
parse: function ErrorStackParser$$parse(error) {
if (typeof error.stacktrace !== 'undefined' || typeof error['opera#sourceloc'] !== 'undefined') {
return this.parseOpera(error);
} else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {
return this.parseV8OrIE(error);
} else if (error.stack) {
return this.parseFFOrSafari(error);
} else {
throw new Error('Cannot parse given Error object');
}
}, | Given an Error object, extract the most information from it.
@param {Error} error object
@return {Array} of StackFrames | $parse ( error ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/main.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/main.js | MIT |
module.exports = function (css) {
// get current location
var location = typeof window !== "undefined" && window.location;
if (!location) {
throw new Error("fixUrls requires window.location");
} // blank or null?
if (!css || typeof css !== "string") {
return css;
}
var baseUrl = location.protocol + "//" + location.host;
var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/"); // convert each url(...)
/*
This regular expression is just a way to recursively match brackets within
a string.
/url\s*\( = Match on the word "url" with any whitespace after it and then a parens
( = Start a capturing group
(?: = Start a non-capturing group
[^)(] = Match anything that isn't a parentheses
| = OR
\( = Match a start parentheses
(?: = Start another non-capturing groups
[^)(]+ = Match anything that isn't a parentheses
| = OR
\( = Match a start parentheses
[^)(]* = Match anything that isn't a parentheses
\) = Match a end parentheses
) = End Group
*\) = Match anything and then a close parens
) = Close non-capturing group
* = Match anything
) = Close capturing group
\) = Match a close parens
/gi = Get all matches, not the first. Be case insensitive.
*/
var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function (fullMatch, origUrl) {
// strip quotes (if they exist)
var unquotedOrigUrl = origUrl.trim().replace(/^"(.*)"$/, function (o, $1) {
return $1;
}).replace(/^'(.*)'$/, function (o, $1) {
return $1;
}); // already a full url? no change
if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
return fullMatch;
} // convert the url to a full url
var newUrl;
if (unquotedOrigUrl.indexOf("//") === 0) {
//TODO: should we add protocol?
newUrl = unquotedOrigUrl;
} else if (unquotedOrigUrl.indexOf("/") === 0) {
// path should be relative to the base url
newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
} else {
// path should be relative to current directory
newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
} // send back the fixed url(...)
return "url(" + JSON.stringify(newUrl) + ")";
}); // send back the fixed css
return fixedCss;
};
/***/ }), | When source maps are enabled, `style-loader` uses a link element with a data-uri to
embed the css on the page. This breaks all relative urls because now they are relative to a
bundle instead of the current page.
One solution is to only use full urls, but that may be impossible.
Instead, this function "fixes" the relative urls to be absolute according to the current page location.
A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command. | module.exports ( css ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/main.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/main.js | MIT |
function getNative(object, key) {
var value = getValue(object, key);
return baseIsNative(value) ? value : undefined;
} | Gets the native function at `key` of `object`.
@private
@param {Object} object The object to query.
@param {string} key The key of the method to get.
@returns {*} Returns the function if it's native, else `undefined`. | getNative ( object , key ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function getArg(aArgs, aName, aDefaultValue) {
if (aName in aArgs) {
return aArgs[aName];
} else if (arguments.length === 3) {
return aDefaultValue;
} else {
throw new Error('"' + aName + '" is a required argument.');
}
} | This is a helper function for getting values from parameter/options
objects.
@param args The object we are extracting values from
@param name The name of the property we are getting.
@param defaultValue An optional value to return if the property is missing
from the object. If this is not specified and the property is missing, an
error will be thrown. | getArg ( aArgs , aName , aDefaultValue ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function lruMemoize(f) {
var cache = [];
return function (input) {
for (var i = 0; i < cache.length; i++) {
if (cache[i].input === input) {
var temp = cache[0];
cache[0] = cache[i];
cache[i] = temp;
return cache[0].result;
}
}
var result = f(input);
cache.unshift({
input,
result
});
if (cache.length > MAX_CACHED_INPUTS) {
cache.pop();
}
return result;
};
} | Takes some function `f(input) -> result` and returns a memoized version of
`f`.
We keep at most `MAX_CACHED_INPUTS` memoized results of `f` alive. The
memoization is a dumb-simple, linear least-recently-used cache. | lruMemoize ( f ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
var normalize = lruMemoize(function normalize(aPath) {
var path = aPath;
var url = urlParse(aPath);
if (url) {
if (!url.path) {
return aPath;
}
path = url.path;
}
var isAbsolute = exports.isAbsolute(path); // Split the path into parts between `/` characters. This is much faster than
// using `.split(/\/+/g)`.
var parts = [];
var start = 0;
var i = 0;
while (true) {
start = i;
i = path.indexOf("/", start);
if (i === -1) {
parts.push(path.slice(start));
break;
} else {
parts.push(path.slice(start, i));
while (i < path.length && path[i] === "/") {
i++;
}
}
}
for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
part = parts[i];
if (part === '.') {
parts.splice(i, 1);
} else if (part === '..') {
up++;
} else if (up > 0) {
if (part === '') {
// The first part is blank if the path is absolute. Trying to go
// above the root is a no-op. Therefore we can remove all '..' parts
// directly after the root.
parts.splice(i + 1, up);
up = 0;
} else {
parts.splice(i, 2);
up--;
}
}
}
path = parts.join('/');
if (path === '') {
path = isAbsolute ? '/' : '.';
}
if (url) {
url.path = path;
return urlGenerate(url);
}
return path;
}); | Normalizes a path, or the path portion of a URL:
- Replaces consecutive slashes with one slash.
- Removes unnecessary '.' parts.
- Removes unnecessary '<dir>/..' parts.
Based on code in the Node.js 'path' core module.
@param aPath The path or url to normalize. | normalize ( aPath ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function join(aRoot, aPath) {
if (aRoot === "") {
aRoot = ".";
}
if (aPath === "") {
aPath = ".";
}
var aPathUrl = urlParse(aPath);
var aRootUrl = urlParse(aRoot);
if (aRootUrl) {
aRoot = aRootUrl.path || '/';
} // `join(foo, '//www.example.org')`
if (aPathUrl && !aPathUrl.scheme) {
if (aRootUrl) {
aPathUrl.scheme = aRootUrl.scheme;
}
return urlGenerate(aPathUrl);
}
if (aPathUrl || aPath.match(dataUrlRegexp)) {
return aPath;
} // `join('http://', 'www.example.com')`
if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
aRootUrl.host = aPath;
return urlGenerate(aRootUrl);
}
var joined = aPath.charAt(0) === '/' ? aPath : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
if (aRootUrl) {
aRootUrl.path = joined;
return urlGenerate(aRootUrl);
}
return joined;
} | Joins two paths/URLs.
@param aRoot The root path or URL.
@param aPath The path or URL to be joined with the root.
- If aPath is a URL or a data URI, aPath is returned, unless aPath is a
scheme-relative URL: Then the scheme of aRoot, if any, is prepended
first.
- Otherwise aPath is a path. If aRoot is a URL, then its path portion
is updated with the result and aRoot is returned. Otherwise the result
is returned.
- If aPath is absolute, the result is aPath.
- Otherwise the two paths are joined with a slash.
- Joining for example 'http://' and 'www.example.com' is also supported. | join ( aRoot , aPath ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
var cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0 || onlyCompareOriginal) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
} | Comparator between two mappings where the original positions are compared.
Optionally pass in `true` as `onlyCompareGenerated` to consider two
mappings with the same original source/line/column, but different generated
line and column the same. Useful when searching for a mapping with a
stubbed out mapping. | compareByOriginalPositions ( mappingA , mappingB , onlyCompareOriginal ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
var cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0 || onlyCompareGenerated) {
return cmp;
}
cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
} | Comparator between two mappings with deflated source and name indices where
the generated positions are compared.
Optionally pass in `true` as `onlyCompareGenerated` to consider two
mappings with the same generated line and column, but different
source/name/original line and column the same. Useful when searching for a
mapping with a stubbed out mapping. | compareByGeneratedPositionsDeflated ( mappingA , mappingB , onlyCompareGenerated ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function compareByGeneratedPositionsInflated(mappingA, mappingB) {
var cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0) {
return cmp;
}
cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
} | Comparator between two mappings with inflated source and name strings where
the generated positions are compared. | compareByGeneratedPositionsInflated ( mappingA , mappingB ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function parseSourceMapInput(str) {
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
}
exports.parseSourceMapInput = parseSourceMapInput;
/**
* Compute the URL of a source given the the source root, the source's
* URL, and the source map's URL.
*/
function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
sourceURL = sourceURL || '';
if (sourceRoot) {
// This follows what Chrome does.
if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
sourceRoot += '/';
} // The spec says:
// Line 4: An optional source root, useful for relocating source
// files on a server or removing repeated values in the
// “sources” entry. This value is prepended to the individual
// entries in the “source” field.
sourceURL = sourceRoot + sourceURL;
} // Historically, SourceMapConsumer did not take the sourceMapURL as
// a parameter. This mode is still somewhat supported, which is why
// this code block is conditional. However, it's preferable to pass
// the source map URL to SourceMapConsumer, so that this function
// can implement the source URL resolution algorithm as outlined in
// the spec. This block is basically the equivalent of:
// new URL(sourceURL, sourceMapURL).toString()
// ... except it avoids using URL, which wasn't available in the
// older releases of node still supported by this library.
//
// The spec says:
// If the sources are not absolute URLs after prepending of the
// “sourceRoot”, the sources are resolved relative to the
// SourceMap (like resolving script src in a html document).
if (sourceMapURL) {
var parsed = urlParse(sourceMapURL);
if (!parsed) {
throw new Error("sourceMapURL could not be parsed");
}
if (parsed.path) {
// Strip the last path component, but keep the "/".
var index = parsed.path.lastIndexOf('/');
if (index >= 0) {
parsed.path = parsed.path.substring(0, index + 1);
}
}
sourceURL = join(urlGenerate(parsed), sourceURL);
}
return normalize(sourceURL);
}
exports.computeSourceURL = computeSourceURL;
/***/ }), | Strip any JSON XSSI avoidance prefix from the string (as documented
in the source maps specification), and then parse the string as
JSON. | parseSourceMapInput ( str ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function ListCache(entries) {
var index = -1,
length = entries == null ? 0 : entries.length;
this.clear();
while (++index < length) {
var entry = entries[index];
this.set(entry[0], entry[1]);
}
} // Add methods to `ListCache`. | Creates an list cache object.
@private
@constructor
@param {Array} [entries] The key-value pairs to cache. | ListCache ( entries ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function assocIndexOf(array, key) {
var length = array.length;
while (length--) {
if (eq(array[length][0], key)) {
return length;
}
}
return -1;
} | Gets the index at which the `key` is found in `array` of key-value pairs.
@private
@param {Array} array The array to inspect.
@param {*} key The key to search for.
@returns {number} Returns the index of the matched value, else `-1`. | assocIndexOf ( array , key ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function getMapData(map, key) {
var data = map.__data__;
return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map;
} | Gets the data for `map`.
@private
@param {Object} map The map to query.
@param {string} key The reference key.
@returns {*} Returns the map data. | getMapData ( map , key ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function copyObject(source, props, object, customizer) {
var isNew = !object;
object || (object = {});
var index = -1,
length = props.length;
while (++index < length) {
var key = props[index];
var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined;
if (newValue === undefined) {
newValue = source[key];
}
if (isNew) {
baseAssignValue(object, key, newValue);
} else {
assignValue(object, key, newValue);
}
}
return object;
} | Copies properties of `source` to `object`.
@private
@param {Object} source The object to copy properties from.
@param {Array} props The property identifiers to copy.
@param {Object} [object={}] The object to copy properties to.
@param {Function} [customizer] The function to customize copied values.
@returns {Object} Returns `object`. | copyObject ( source , props , object , customizer ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function keysIn(object) {
return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
} | Creates an array of the own and inherited enumerable property names of `object`.
**Note:** Non-object values are coerced to objects.
@static
@memberOf _
@since 3.0.0
@category Object
@param {Object} object The object to query.
@returns {Array} Returns the array of property names.
@example
function Foo() {
this.a = 1;
this.b = 2;
}
Foo.prototype.c = 3;
_.keysIn(new Foo);
// => ['a', 'b', 'c'] (iteration order is not guaranteed) | keysIn ( object ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function cloneArrayBuffer(arrayBuffer) {
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
return result;
} | Creates a clone of `arrayBuffer`.
@private
@param {ArrayBuffer} arrayBuffer The array buffer to clone.
@returns {ArrayBuffer} Returns the cloned array buffer. | cloneArrayBuffer ( arrayBuffer ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function eq(value, other) {
return value === other || value !== value && other !== other;
} | Performs a
[`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
comparison between two values to determine if they are equivalent.
@static
@memberOf _
@since 4.0.0
@category Lang
@param {*} value The value to compare.
@param {*} other The other value to compare.
@returns {boolean} Returns `true` if the values are equivalent, else `false`.
@example
var object = { 'a': 1 };
var other = { 'a': 1 };
_.eq(object, object);
// => true
_.eq(object, other);
// => false
_.eq('a', 'a');
// => true
_.eq('a', Object('a'));
// => false
_.eq(NaN, NaN);
// => true | eq ( value , other ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function toSource(func) {
if (func != null) {
try {
return funcToString.call(func);
} catch (e) {}
try {
return func + '';
} catch (e) {}
}
return '';
} | Converts `func` to its source code.
@private
@param {Function} func The function to convert.
@returns {string} Returns the source code. | toSource ( func ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function assignValue(object, key, value) {
var objValue = object[key];
if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === undefined && !(key in object)) {
baseAssignValue(object, key, value);
}
} | Assigns `value` to `key` of `object` if the existing value is not equivalent
using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
for equality comparisons.
@private
@param {Object} object The object to modify.
@param {string} key The key of the property to assign.
@param {*} value The value to assign. | assignValue ( object , key , value ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function baseAssignValue(object, key, value) {
if (key == '__proto__' && defineProperty) {
defineProperty(object, key, {
'configurable': true,
'enumerable': true,
'value': value,
'writable': true
});
} else {
object[key] = value;
}
} | The base implementation of `assignValue` and `assignMergeValue` without
value checks.
@private
@param {Object} object The object to modify.
@param {string} key The key of the property to assign.
@param {*} value The value to assign. | baseAssignValue ( object , key , value ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function stubArray() {
return [];
} | This method returns a new empty array.
@static
@memberOf _
@since 4.13.0
@category Util
@returns {Array} Returns the new empty array.
@example
var arrays = _.times(2, _.stubArray);
console.log(arrays);
// => [[], []]
console.log(arrays[0] === arrays[1]);
// => false | stubArray ( ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function arrayPush(array, values) {
var index = -1,
length = values.length,
offset = array.length;
while (++index < length) {
array[offset + index] = values[index];
}
return array;
} | Appends the elements of `values` to `array`.
@private
@param {Array} array The array to modify.
@param {Array} values The values to append.
@returns {Array} Returns `array`. | arrayPush ( array , values ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
var result = keysFunc(object);
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
} | The base implementation of `getAllKeys` and `getAllKeysIn` which uses
`keysFunc` and `symbolsFunc` to get the enumerable property names and
symbols of `object`.
@private
@param {Object} object The object to query.
@param {Function} keysFunc The function to get the keys of `object`.
@param {Function} symbolsFunc The function to get the symbols of `object`.
@returns {Array} Returns the array of property names and symbols. | baseGetAllKeys ( object , keysFunc , symbolsFunc ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function SourceMapGenerator(aArgs) {
if (!aArgs) {
aArgs = {};
}
this._file = util.getArg(aArgs, 'file', null);
this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
this._sources = new ArraySet();
this._names = new ArraySet();
this._mappings = new MappingList();
this._sourcesContents = null;
} | An instance of the SourceMapGenerator represents a source map which is
being built incrementally. You may pass an object with the following
properties:
- file: The filename of the generated source.
- sourceRoot: A root for all relative URLs in this source map. | SourceMapGenerator ( aArgs ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
SourceMapGenerator.fromSourceMap = function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
var sourceRoot = aSourceMapConsumer.sourceRoot;
var generator = new SourceMapGenerator({
file: aSourceMapConsumer.file,
sourceRoot: sourceRoot
});
aSourceMapConsumer.eachMapping(function (mapping) {
var newMapping = {
generated: {
line: mapping.generatedLine,
column: mapping.generatedColumn
}
};
if (mapping.source != null) {
newMapping.source = mapping.source;
if (sourceRoot != null) {
newMapping.source = util.relative(sourceRoot, newMapping.source);
}
newMapping.original = {
line: mapping.originalLine,
column: mapping.originalColumn
};
if (mapping.name != null) {
newMapping.name = mapping.name;
}
}
generator.addMapping(newMapping);
});
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
generator.setSourceContent(sourceFile, content);
}
});
return generator;
}; | Creates a new SourceMapGenerator based on a SourceMapConsumer
@param aSourceMapConsumer The SourceMap. | SourceMapGenerator_fromSourceMap ( aSourceMapConsumer ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
SourceMapGenerator.prototype.addMapping = function SourceMapGenerator_addMapping(aArgs) {
var generated = util.getArg(aArgs, 'generated');
var original = util.getArg(aArgs, 'original', null);
var source = util.getArg(aArgs, 'source', null);
var name = util.getArg(aArgs, 'name', null);
if (!this._skipValidation) {
this._validateMapping(generated, original, source, name);
}
if (source != null) {
source = String(source);
if (!this._sources.has(source)) {
this._sources.add(source);
}
}
if (name != null) {
name = String(name);
if (!this._names.has(name)) {
this._names.add(name);
}
}
this._mappings.add({
generatedLine: generated.line,
generatedColumn: generated.column,
originalLine: original != null && original.line,
originalColumn: original != null && original.column,
source: source,
name: name
});
}; | Add a single mapping from original source line and column to the generated
source's line and column for this source map being created. The mapping
object should have the following properties:
- generated: An object with the generated line and column positions.
- original: An object with the original line and column positions.
- source: The original source file (relative to the sourceRoot).
- name: An optional original token name for this mapping. | SourceMapGenerator_addMapping ( aArgs ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
SourceMapGenerator.prototype.setSourceContent = function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
var source = aSourceFile;
if (this._sourceRoot != null) {
source = util.relative(this._sourceRoot, source);
}
if (aSourceContent != null) {
// Add the source content to the _sourcesContents map.
// Create a new _sourcesContents map if the property is null.
if (!this._sourcesContents) {
this._sourcesContents = Object.create(null);
}
this._sourcesContents[util.toSetString(source)] = aSourceContent;
} else if (this._sourcesContents) {
// Remove the source file from the _sourcesContents map.
// If the _sourcesContents map is empty, set the property to null.
delete this._sourcesContents[util.toSetString(source)];
if (Object.keys(this._sourcesContents).length === 0) {
this._sourcesContents = null;
}
}
}; | Set the source content for a source file. | SourceMapGenerator_setSourceContent ( aSourceFile , aSourceContent ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
SourceMapGenerator.prototype.applySourceMap = function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
var sourceFile = aSourceFile; // If aSourceFile is omitted, we will use the file property of the SourceMap
if (aSourceFile == null) {
if (aSourceMapConsumer.file == null) {
throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + 'or the source map\'s "file" property. Both were omitted.');
}
sourceFile = aSourceMapConsumer.file;
}
var sourceRoot = this._sourceRoot; // Make "sourceFile" relative if an absolute Url is passed.
if (sourceRoot != null) {
sourceFile = util.relative(sourceRoot, sourceFile);
} // Applying the SourceMap can add and remove items from the sources and
// the names array.
var newSources = new ArraySet();
var newNames = new ArraySet(); // Find mappings for the "sourceFile"
this._mappings.unsortedForEach(function (mapping) {
if (mapping.source === sourceFile && mapping.originalLine != null) {
// Check if it can be mapped by the source map, then update the mapping.
var original = aSourceMapConsumer.originalPositionFor({
line: mapping.originalLine,
column: mapping.originalColumn
});
if (original.source != null) {
// Copy mapping
mapping.source = original.source;
if (aSourceMapPath != null) {
mapping.source = util.join(aSourceMapPath, mapping.source);
}
if (sourceRoot != null) {
mapping.source = util.relative(sourceRoot, mapping.source);
}
mapping.originalLine = original.line;
mapping.originalColumn = original.column;
if (original.name != null) {
mapping.name = original.name;
}
}
}
var source = mapping.source;
if (source != null && !newSources.has(source)) {
newSources.add(source);
}
var name = mapping.name;
if (name != null && !newNames.has(name)) {
newNames.add(name);
}
}, this);
this._sources = newSources;
this._names = newNames; // Copy sourcesContents of applied map.
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
if (aSourceMapPath != null) {
sourceFile = util.join(aSourceMapPath, sourceFile);
}
if (sourceRoot != null) {
sourceFile = util.relative(sourceRoot, sourceFile);
}
this.setSourceContent(sourceFile, content);
}
}, this);
}; | Applies the mappings of a sub-source-map for a specific source file to the
source map being generated. Each mapping to the supplied source file is
rewritten using the supplied source map. Note: The resolution for the
resulting mappings is the minimium of this map and the supplied map.
@param aSourceMapConsumer The source map to be applied.
@param aSourceFile Optional. The filename of the source file.
If omitted, SourceMapConsumer's file property will be used.
@param aSourceMapPath Optional. The dirname of the path to the source map
to be applied. If relative, it is relative to the SourceMapConsumer.
This parameter is needed when the two source maps aren't in the same
directory, and the source map to be applied contains relative source
paths. If so, those relative source paths need to be rewritten
relative to the SourceMapGenerator. | SourceMapGenerator_applySourceMap ( aSourceMapConsumer , aSourceFile , aSourceMapPath ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
SourceMapGenerator.prototype._validateMapping = function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, aName) {
// When aOriginal is truthy but has empty values for .line and .column,
// it is most likely a programmer error. In this case we throw a very
// specific error message to try to guide them the right way.
// For example: https://github.com/Polymer/polymer-bundler/pull/519
if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
throw new Error('original.line and original.column are not numbers -- you probably meant to omit ' + 'the original mapping entirely and only map the generated position. If so, pass ' + 'null for the original mapping instead of an object with empty or null values.');
}
if (aGenerated && 'line' in aGenerated && 'column' in aGenerated && aGenerated.line > 0 && aGenerated.column >= 0 && !aOriginal && !aSource && !aName) {
// Case 1.
return;
} else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated && aOriginal && 'line' in aOriginal && 'column' in aOriginal && aGenerated.line > 0 && aGenerated.column >= 0 && aOriginal.line > 0 && aOriginal.column >= 0 && aSource) {
// Cases 2 and 3.
return;
} else {
throw new Error('Invalid mapping: ' + JSON.stringify({
generated: aGenerated,
source: aSource,
original: aOriginal,
name: aName
}));
}
}; | A mapping can have one of the three levels of data:
1. Just the generated position.
2. The Generated position, original position, and original source.
3. Generated and original position, original source, as well as a name
token.
To maintain consistency, we validate that any new mapping being added falls
in to one of these categories. | SourceMapGenerator_validateMapping ( aGenerated , aOriginal , aSource , aName ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
SourceMapGenerator.prototype._serializeMappings = function SourceMapGenerator_serializeMappings() {
var previousGeneratedColumn = 0;
var previousGeneratedLine = 1;
var previousOriginalColumn = 0;
var previousOriginalLine = 0;
var previousName = 0;
var previousSource = 0;
var result = '';
var next;
var mapping;
var nameIdx;
var sourceIdx;
var mappings = this._mappings.toArray();
for (var i = 0, len = mappings.length; i < len; i++) {
mapping = mappings[i];
next = '';
if (mapping.generatedLine !== previousGeneratedLine) {
previousGeneratedColumn = 0;
while (mapping.generatedLine !== previousGeneratedLine) {
next += ';';
previousGeneratedLine++;
}
} else {
if (i > 0) {
if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
continue;
}
next += ',';
}
}
next += base64VLQ.encode(mapping.generatedColumn - previousGeneratedColumn);
previousGeneratedColumn = mapping.generatedColumn;
if (mapping.source != null) {
sourceIdx = this._sources.indexOf(mapping.source);
next += base64VLQ.encode(sourceIdx - previousSource);
previousSource = sourceIdx; // lines are stored 0-based in SourceMap spec version 3
next += base64VLQ.encode(mapping.originalLine - 1 - previousOriginalLine);
previousOriginalLine = mapping.originalLine - 1;
next += base64VLQ.encode(mapping.originalColumn - previousOriginalColumn);
previousOriginalColumn = mapping.originalColumn;
if (mapping.name != null) {
nameIdx = this._names.indexOf(mapping.name);
next += base64VLQ.encode(nameIdx - previousName);
previousName = nameIdx;
}
}
result += next;
}
return result;
}; | Serialize the accumulated mappings in to the stream of base 64 VLQs
specified by the source map format. | SourceMapGenerator_serializeMappings ( ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
SourceMapGenerator.prototype.toString = function SourceMapGenerator_toString() {
return JSON.stringify(this.toJSON());
}; | Render the source map being generated to a string. | SourceMapGenerator_toString ( ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function toVLQSigned(aValue) {
return aValue < 0 ? (-aValue << 1) + 1 : (aValue << 1) + 0;
} | Converts from a two-complement value to a value where the sign bit is
placed in the least significant bit. For example, as decimals:
1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
2 becomes 4 (100 binary), -2 becomes 5 (101 binary) | toVLQSigned ( aValue ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function fromVLQSigned(aValue) {
var isNegative = (aValue & 1) === 1;
var shifted = aValue >> 1;
return isNegative ? -shifted : shifted;
} | Converts to a two-complement value from a value where the sign bit is
placed in the least significant bit. For example, as decimals:
2 (10 binary) becomes 1, 3 (11 binary) becomes -1
4 (100 binary) becomes 2, 5 (101 binary) becomes -2 | fromVLQSigned ( aValue ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
exports.encode = function base64VLQ_encode(aValue) {
var encoded = "";
var digit;
var vlq = toVLQSigned(aValue);
do {
digit = vlq & VLQ_BASE_MASK;
vlq >>>= VLQ_BASE_SHIFT;
if (vlq > 0) {
// There are still more digits in this value, so we must make sure the
// continuation bit is marked.
digit |= VLQ_CONTINUATION_BIT;
}
encoded += base64.encode(digit);
} while (vlq > 0);
return encoded;
}; | Returns the base 64 VLQ encoded value. | base64VLQ_encode ( aValue ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
var strLen = aStr.length;
var result = 0;
var shift = 0;
var continuation, digit;
do {
if (aIndex >= strLen) {
throw new Error("Expected more digits in base 64 VLQ value.");
}
digit = base64.decode(aStr.charCodeAt(aIndex++));
if (digit === -1) {
throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
}
continuation = !!(digit & VLQ_CONTINUATION_BIT);
digit &= VLQ_BASE_MASK;
result = result + (digit << shift);
shift += VLQ_BASE_SHIFT;
} while (continuation);
aOutParam.value = fromVLQSigned(result);
aOutParam.rest = aIndex;
}; | Decodes the next base 64 VLQ value from the given string and returns the
value and the rest of the string via the out parameter. | base64VLQ_decode ( aStr , aIndex , aOutParam ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function ArraySet() {
this._array = [];
this._set = hasNativeMap ? new Map() : Object.create(null);
} | A data structure which is a combination of an array and a set. Adding a new
member is O(1), testing for membership is O(1), and finding the index of an
element is O(1). Removing elements from the set is not supported. Only
strings are supported for membership. | ArraySet ( ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
var set = new ArraySet();
for (var i = 0, len = aArray.length; i < len; i++) {
set.add(aArray[i], aAllowDuplicates);
}
return set;
}; | Static method for creating ArraySet instances from an existing array. | ArraySet_fromArray ( aArray , aAllowDuplicates ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
ArraySet.prototype.size = function ArraySet_size() {
return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
}; | Return how many unique items are in this ArraySet. If duplicates have been
added, than those do not count towards the size.
@returns Number | ArraySet_size ( ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
var idx = this._array.length;
if (!isDuplicate || aAllowDuplicates) {
this._array.push(aStr);
}
if (!isDuplicate) {
if (hasNativeMap) {
this._set.set(aStr, idx);
} else {
this._set[sStr] = idx;
}
}
}; | Add the given string to this set.
@param String aStr | ArraySet_add ( aStr , aAllowDuplicates ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
ArraySet.prototype.has = function ArraySet_has(aStr) {
if (hasNativeMap) {
return this._set.has(aStr);
} else {
var sStr = util.toSetString(aStr);
return has.call(this._set, sStr);
}
}; | Is the given string a member of this set?
@param String aStr | ArraySet_has ( aStr ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
if (hasNativeMap) {
var idx = this._set.get(aStr);
if (idx >= 0) {
return idx;
}
} else {
var sStr = util.toSetString(aStr);
if (has.call(this._set, sStr)) {
return this._set[sStr];
}
}
throw new Error('"' + aStr + '" is not in the set.');
}; | What is the index of the given string in the array?
@param String aStr | ArraySet_indexOf ( aStr ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
ArraySet.prototype.at = function ArraySet_at(aIdx) {
if (aIdx >= 0 && aIdx < this._array.length) {
return this._array[aIdx];
}
throw new Error('No element indexed by ' + aIdx);
}; | What is the element at the given index?
@param Number aIdx | ArraySet_at ( aIdx ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
ArraySet.prototype.toArray = function ArraySet_toArray() {
return this._array.slice();
}; | Returns the array representation of this set (which has the proper indices
indicated by indexOf). Note that this is a copy of the internal array used
for storing the members so that no one can mess with internal state. | ArraySet_toArray ( ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function clone(value) {
return baseClone(value, CLONE_SYMBOLS_FLAG);
} | Creates a shallow clone of `value`.
**Note:** This method is loosely based on the
[structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
and supports cloning arrays, array buffers, booleans, date objects, maps,
numbers, `Object` objects, regexes, sets, strings, symbols, and typed
arrays. The own enumerable properties of `arguments` objects are cloned
as plain objects. An empty object is returned for uncloneable values such
as error objects, functions, DOM nodes, and WeakMaps.
@static
@memberOf _
@since 0.1.0
@category Lang
@param {*} value The value to clone.
@returns {*} Returns the cloned value.
@see _.cloneDeep
@example
var objects = [{ 'a': 1 }, { 'b': 2 }];
var shallow = _.clone(objects);
console.log(shallow[0] === objects[0]);
// => true | clone ( value ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function baseClone(value, bitmask, customizer, key, object, stack) {
var result,
isDeep = bitmask & CLONE_DEEP_FLAG,
isFlat = bitmask & CLONE_FLAT_FLAG,
isFull = bitmask & CLONE_SYMBOLS_FLAG;
if (customizer) {
result = object ? customizer(value, key, object, stack) : customizer(value);
}
if (result !== undefined) {
return result;
}
if (!isObject(value)) {
return value;
}
var isArr = isArray(value);
if (isArr) {
result = initCloneArray(value);
if (!isDeep) {
return copyArray(value, result);
}
} else {
var tag = getTag(value),
isFunc = tag == funcTag || tag == genTag;
if (isBuffer(value)) {
return cloneBuffer(value, isDeep);
}
if (tag == objectTag || tag == argsTag || isFunc && !object) {
result = isFlat || isFunc ? {} : initCloneObject(value);
if (!isDeep) {
return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
}
} else {
if (!cloneableTags[tag]) {
return object ? value : {};
}
result = initCloneByTag(value, tag, isDeep);
}
} // Check for circular references and return its corresponding clone.
stack || (stack = new Stack());
var stacked = stack.get(value);
if (stacked) {
return stacked;
}
stack.set(value, result);
if (isSet(value)) {
value.forEach(function (subValue) {
result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
});
} else if (isMap(value)) {
value.forEach(function (subValue, key) {
result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
});
}
var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
var props = isArr ? undefined : keysFunc(value);
arrayEach(props || value, function (subValue, key) {
if (props) {
key = subValue;
subValue = value[key];
} // Recursively populate clone (susceptible to call stack limits).
assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
});
return result;
} | The base implementation of `_.clone` and `_.cloneDeep` which tracks
traversed objects.
@private
@param {*} value The value to clone.
@param {boolean} bitmask The bitmask flags.
1 - Deep clone
2 - Flatten inherited properties
4 - Clone symbols
@param {Function} [customizer] The function to customize cloning.
@param {string} [key] The key of `value`.
@param {Object} [object] The parent object of `value`.
@param {Object} [stack] Tracks traversed objects and their clone counterparts.
@returns {*} Returns the cloned value. | baseClone ( value , bitmask , customizer , key , object , stack ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function Stack(entries) {
var data = this.__data__ = new ListCache(entries);
this.size = data.size;
} // Add methods to `Stack`. | Creates a stack cache object to store key-value pairs.
@private
@constructor
@param {Array} [entries] The key-value pairs to cache. | Stack ( entries ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function listCacheClear() {
this.__data__ = [];
this.size = 0;
} | Removes all key-value entries from the list cache.
@private
@name clear
@memberOf ListCache | listCacheClear ( ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
function listCacheDelete(key) {
var data = this.__data__,
index = assocIndexOf(data, key);
if (index < 0) {
return false;
}
var lastIndex = data.length - 1;
if (index == lastIndex) {
data.pop();
} else {
splice.call(data, index, 1);
}
--this.size;
return true;
} | Removes `key` and its value from the list cache.
@private
@name delete
@memberOf ListCache
@param {string} key The key of the value to remove.
@returns {boolean} Returns `true` if the entry was removed, else `false`. | listCacheDelete ( key ) | javascript | open-source-labs/Swell | ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | https://github.com/open-source-labs/Swell/blob/master/ReactDevToolsWebExtDep/rbuild/parseSourceAndMetadata.worker.worker.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.