Merge 618863ecf14b99e12ad9a055f91db2fe74d651a9 into ddbe9141322baf88b575ac1615b8e68d3c53b412

This commit is contained in:
Vignesh Rajan 2026-06-19 22:22:30 +02:00 committed by GitHub
commit 6875e58040
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 7 deletions

View File

@ -108,10 +108,11 @@ export function mean(data) {
* @returns {BigNumber}
*/
export function median(data) {
if ((data.length % 2) === 0 && data.length > 0) {
if (data.length === 0) return data[0];
data.sort(function(a, b) {
return a.minus(b);
});
if ((data.length % 2) === 0) {
const first = data[Math.floor(data.length / 2)];
const second = data[Math.floor(data.length / 2) - 1];
return mean([first, second]);

View File

@ -75,7 +75,7 @@ class SetDifference extends Operation {
* @returns {Object[]}
*/
runSetDifference(a, b) {
return a
return [...new Set(a)]
.filter((item) => {
return b.indexOf(item) === -1;
})

View File

@ -75,7 +75,7 @@ class SetIntersection extends Operation {
* @returns {Object[]}
*/
runIntersect(a, b) {
return a
return [...new Set(a)]
.filter((item) => {
return b.indexOf(item) > -1;
})

View File

@ -56,7 +56,8 @@ class UnescapeUnicodeCharacters extends Operation {
*/
run(input, args) {
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 = "",
m,
i = 0;