deftomat / just-location-base

Returns a location base and base path.

Home Page:https://www.npmjs.com/package/just-location-base

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Just Location Base

code style: prettier

A simple package which returns a location base and base path.

Why ?

When you add <base href="/dashboard"> to your HTML, it is quite tedious to get a base or base path inside your JS code.

Installation

npm install just-location-base --save

or

yarn add just-location-base

Usage

HTML:

<head>
  <base href="/dashboard">
</head>

JavaScript:

import { getBase, getBasePath } from 'just-location-base';

const base = getBase(); // "http://localhost/dashboard"
const basePath = getBasePath(); // "/dashboard"

About

Returns a location base and base path.

https://www.npmjs.com/package/just-location-base

License:MIT License


Languages

Language:TypeScript 91.8%Language:JavaScript 8.2%