convert an array of words to a single token, based on the configuration provided in casetype.
words
casetype
to reverse the operation of this function, use the tokenToWords function with the same casetype config that you use here.
import { assertEquals as eq } from "jsr:@std/assert"const words = ["convert", "windows", "path", "to", "unix"]const snakeCase: NamingCaseTuple = [-1, -1, -1, "_"], kebabCase: NamingCaseTuple = [-1, -1, -1, "-"], camelCase: NamingCaseTuple = [-1, 1, -1, ""], pascalCase: NamingCaseTuple = [1, 1, -1, ""], screamingSnakeCase: NamingCaseTuple = [1, 1, 1, "_"], screamingKebabCase: NamingCaseTuple = [1, 1, 1, "-"]eq(wordsToToken(snakeCase, words), "convert_windows_path_to_unix")eq(wordsToToken(kebabCase, words), "convert-windows-path-to-unix")eq(wordsToToken(camelCase, words), "convertWindowsPathToUnix")eq(wordsToToken(pascalCase, words), "ConvertWindowsPathToUnix")eq(wordsToToken(screamingSnakeCase, words), "CONVERT_WINDOWS_PATH_TO_UNIX")eq(wordsToToken(screamingKebabCase, words), "CONVERT-WINDOWS-PATH-TO-UNIX") Copy
import { assertEquals as eq } from "jsr:@std/assert"const words = ["convert", "windows", "path", "to", "unix"]const snakeCase: NamingCaseTuple = [-1, -1, -1, "_"], kebabCase: NamingCaseTuple = [-1, -1, -1, "-"], camelCase: NamingCaseTuple = [-1, 1, -1, ""], pascalCase: NamingCaseTuple = [1, 1, -1, ""], screamingSnakeCase: NamingCaseTuple = [1, 1, 1, "_"], screamingKebabCase: NamingCaseTuple = [1, 1, 1, "-"]eq(wordsToToken(snakeCase, words), "convert_windows_path_to_unix")eq(wordsToToken(kebabCase, words), "convert-windows-path-to-unix")eq(wordsToToken(camelCase, words), "convertWindowsPathToUnix")eq(wordsToToken(pascalCase, words), "ConvertWindowsPathToUnix")eq(wordsToToken(screamingSnakeCase, words), "CONVERT_WINDOWS_PATH_TO_UNIX")eq(wordsToToken(screamingKebabCase, words), "CONVERT-WINDOWS-PATH-TO-UNIX")
convert an array of
words
to a single token, based on the configuration provided incasetype
.to reverse the operation of this function, use the tokenToWords function with the same
casetype
config that you use here.Example