@helt/remove-url-scheme
TypeScript icon, indicating that this package has built-in type declarations

2.4.0 • Public • Published

remove-url-scheme

npm (scoped) GitHub issues GitHub stars GitHub forks GitHub license

Removes scheme from URL, e.g. 'Http://'. Case insensitive

Author of regex expression: FailedDev

RegexExpVis

Install

$ npm install @helt/remove-url-scheme

Usage

  1. Register the RemoveUrlSchemeModule in your app module.

import { RemoveUrlSchemeModule } from '@helt/remove-url-scheme';

import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RemoveUrlSchemeModule } from '@helt/remove-url-scheme';
import { AppComponent } from './app.component';

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    BrowserAnimationsModule,
    ...
    HttpClientModule,
    RemoveUrlSchemeModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {}
 
  1. Used through pipe operator in template or DI in component
<button mat-stroked-button>
    <i class="material-icons">language</i>
    {{'https://github.com' | removeUrlScheme}}
</button>
import { RemoveUrlSchemePipe } from '@helt/remove-url-scheme';

export class ExampleComponent implements OnInit {
  newUrl!: string;
  constructor(private removeUrlSchemePipe: RemoveUrlSchemePipe) {
    this.newUrl = this.rus.tranform('https://github.com');
  }
  ngOnInit() {
  }
}

https://github.com -> github.com

http://github.com -> github.com

Package Sidebar

Install

npm i @helt/remove-url-scheme

Weekly Downloads

1

Version

2.4.0

License

MIT

Unpacked Size

26.4 kB

Total Files

23

Last publish

Collaborators

  • helt