slash-sandwich

1.0.12 • Public • Published

Slash sandwich

Glues parts together divided by a single slash.

Installation:

npm i slash-sandwich

Examples:

    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/"   

Readme

Keywords

none

Package Sidebar

Install

npm i slash-sandwich

Weekly Downloads

11

Version

1.0.12

License

ISC

Unpacked Size

8.79 kB

Total Files

8

Last publish

Collaborators

  • jeffreyzuttzz