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

io.github.kelvindev15.npm.NpmScript.kt Maven / Gradle / Ivy

package io.github.kelvindev15.npm

/**
 * Represents a script in a package.json file.
 * [name] is the name of the script.
 * [command] is the command of the script.
 */
data class NpmScript(
    val name: String,
    val command: String,
) {
    companion object {
        /**
         * Converts a pair to a [NpmScript].
         */
        fun from(p: Pair): NpmScript {
            return NpmScript(p.first, p.second)
        }

        /**
         * Converts a map to a set of [NpmScript].
         */
        fun from(vararg deps: Pair): Set {
            return deps.map { from(it) }.toSet()
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy