Glues parts together divided by a single slash.
npm i slash-sandwich
import slashSandwich from "slash-sandwich"
slashSandwich(["foo", "bar"]) // Result: "/foo/bar/"
slashSandwich(["foo", "bar"], { trailingSlash: false }) // Result: "/foo/bar"
slashSandwich(["foo", "bar"], { leadingSlash: false }) // Result: "foo/bar/"
// `null` and `undefined` are stripped
slashSandwich(["foo", undefined "bar"]) // Result: "/foo/bar/"
// leadingSlash is automatically stripped
// when string starts with "http://" or "https://"
slashSandwich(["http://www.domain.com/", "/bar"]) // Result: "http://www.domain.com/bar/"