All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.extract_flags.js Maven / Gradle / Ivy

There is a newer version: 0.50.5
Show newest version
// noinspection JSJQueryEfficiency,ES6ConvertVarToLetConst

// Use this snippet to extract icons from https://fomantic-ui.com/elements/flag.html

// Extract as getters
console.log(
    $("table i[class$='flag']").map((idx, it) => {
        var classes = $(it).attr("class").split(" ").filter(it => it !== "flag");
        var prop = classes.map(it => it.replaceAll("-", "")).join("_")
        return `@SemanticFlagMarker inline val ${prop}: SemanticFlag\n    get() = this + "${classes.join(" ")}"`;
    }).get()
        // Distinct
        .filter((value, index, self) => self.indexOf(value) === index)
        .sort()
        .join("\n")
)

// Extract as class strings
console.log(
    $("table i[class$='flag']").map((idx, it) => {
        var classes = $(it).attr("class").split(" ").filter(it => it !== "flag");
        return `"${classes.join(" ")}"`;
    }).get()
        // Distinct
        .filter((value, index, self) => self.indexOf(value) === index)
        .sort()
        .join(", ")
)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy