just-location-base
TypeScript icon, indicating that this package has built-in type declarations

1.2.2 • Public • Published

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"

Readme

Keywords

Package Sidebar

Install

npm i just-location-base

Weekly Downloads

1

Version

1.2.2

License

MIT

Unpacked Size

4.72 kB

Total Files

8

Last publish

Collaborators

  • deftomat