mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-14 04:29:04 +03:00
90faddf9f1
Change takes a range and a string and replaces the range with the string, then emits a change event with the range of text that was changed, the range of text occupied by the new string, and the string itself. This can be used to implement backspace, insert, as well as various cut and paste manipulations.
13 lines
408 B
JavaScript
13 lines
408 B
JavaScript
var quicksort = function () {
|
|
var sort = function(items) {
|
|
if (items.length <= 1) return items;
|
|
var pivot = items.shift(), current, left = [], right = [];
|
|
while(items.length > 0) {
|
|
current = items.shift();
|
|
current < pivot ? left.push(current) : right.push(current);
|
|
}
|
|
return sort(left).concat(pivot).concat(sort(right));
|
|
};
|
|
|
|
return sort(Array.apply(this, arguments));
|
|
}; |