Using the Node path.join function in Angular or Typescript


This is probably not a good idea. See this SO post:

Also join from node will replace http:// with http:/ . It will remove a slash.

Since we needed join like functionality we created this:

It works in a web context and can be used to join paths in your front end.


We have two paths:

const p1 = '/foo/boo/';const p2 = '/pity/the/foo';

We want to concatenate them without having to first check whether the second path starts with a / .

In other words we want to avoid the concatenated path looking like this:





import { join } from '@fireflysemantics/join';




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ole Ersoy

Ole Ersoy

Founder of Firefly Semantics Corporation