Merge 618863ecf14b99e12ad9a055f91db2fe74d651a9 into ddbe9141322baf88b575ac1615b8e68d3c53b412
This commit is contained in:
commit
6875e58040
@ -108,10 +108,11 @@ export function mean(data) {
|
|||||||
* @returns {BigNumber}
|
* @returns {BigNumber}
|
||||||
*/
|
*/
|
||||||
export function median(data) {
|
export function median(data) {
|
||||||
if ((data.length % 2) === 0 && data.length > 0) {
|
if (data.length === 0) return data[0];
|
||||||
data.sort(function(a, b) {
|
data.sort(function(a, b) {
|
||||||
return a.minus(b);
|
return a.minus(b);
|
||||||
});
|
});
|
||||||
|
if ((data.length % 2) === 0) {
|
||||||
const first = data[Math.floor(data.length / 2)];
|
const first = data[Math.floor(data.length / 2)];
|
||||||
const second = data[Math.floor(data.length / 2) - 1];
|
const second = data[Math.floor(data.length / 2) - 1];
|
||||||
return mean([first, second]);
|
return mean([first, second]);
|
||||||
|
|||||||
@ -75,7 +75,7 @@ class SetDifference extends Operation {
|
|||||||
* @returns {Object[]}
|
* @returns {Object[]}
|
||||||
*/
|
*/
|
||||||
runSetDifference(a, b) {
|
runSetDifference(a, b) {
|
||||||
return a
|
return [...new Set(a)]
|
||||||
.filter((item) => {
|
.filter((item) => {
|
||||||
return b.indexOf(item) === -1;
|
return b.indexOf(item) === -1;
|
||||||
})
|
})
|
||||||
|
|||||||
@ -75,7 +75,7 @@ class SetIntersection extends Operation {
|
|||||||
* @returns {Object[]}
|
* @returns {Object[]}
|
||||||
*/
|
*/
|
||||||
runIntersect(a, b) {
|
runIntersect(a, b) {
|
||||||
return a
|
return [...new Set(a)]
|
||||||
.filter((item) => {
|
.filter((item) => {
|
||||||
return b.indexOf(item) > -1;
|
return b.indexOf(item) > -1;
|
||||||
})
|
})
|
||||||
|
|||||||
@ -56,7 +56,8 @@ class UnescapeUnicodeCharacters extends Operation {
|
|||||||
*/
|
*/
|
||||||
run(input, args) {
|
run(input, args) {
|
||||||
const prefix = prefixToRegex[args[0]],
|
const prefix = prefixToRegex[args[0]],
|
||||||
regex = new RegExp(prefix+"([a-f\\d]{4})", "ig");
|
quantifier = args[0] === "U+" ? "{4,6}" : "{4}",
|
||||||
|
regex = new RegExp(prefix+"([a-f\\d]"+quantifier+")", "ig");
|
||||||
let output = "",
|
let output = "",
|
||||||
m,
|
m,
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user