about summary refs log tree commit diff
path: root/uploader/static/js/data_utils.js
blob: 4bc1d1b9e06f95a7d5d437d399a1a0507e79b4f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/**
 * General data utilities.
 */

/**
 * Parse a whitespace- and/or comma-separated list of unique symbols.
 *
 * This mirrors the Python `r_qtl.utils.parse_missing_values_symbols` so that
 * previews and server-side processing interpret symbol lists the same way.
 */
var parseSymbols = (value) => {
    return [...new Set(
        (value || "")
            .replace(/,/g, " ")
            .split(/\s+/)
            .map((item) => { return item.trim(); })
            .filter((item) => { return Boolean(item); })
    )];
};