Skip to content

massimocandela/brembo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

brembo

A simple utility for building URLs in JavaScript

Example:

import url from 'brembo';
url.build("https://massimocandela.com", {
    path: ["example", "api", "v1"] // This can be a simple string too
    params: {
        a: 1,
        b: 2
    },
    anchor: "here"
});

It will return the following string:

https://massimocandela.com/example/api/v1?a=1&b=2#here

url.parse("https://massimocandela.com/example/api/data.json?a=1&a=2&b=3#here");

It will return the following object:

{
    host: "massimocandela.com",
    protocol: "https",
    path: ["example", "api", "v1"] // This can be a simple string too
    params: {
        a: 1,
        b: 2
    },
    anchor: "here"
}

About

A simple utility for building URLs in JavaScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published