Feature/shared refactor (#1176)

* refactor: move most of the shared entities to @start8labs/shared library
This commit is contained in:
Alex Inkin
2022-02-15 18:13:05 +03:00
committed by GitHub
parent 1769f7e2e6
commit 7c26b18c73
164 changed files with 2908 additions and 2860 deletions

View File

@@ -0,0 +1,13 @@
import { Injectable, OnDestroy } from '@angular/core'
import { ReplaySubject } from 'rxjs'
/**
* Observable abstraction over ngOnDestroy to use with takeUntil
*/
@Injectable()
export class DestroyService extends ReplaySubject<void> implements OnDestroy {
ngOnDestroy() {
this.next()
this.complete()
}
}

View File

@@ -0,0 +1,18 @@
import { Injectable } from '@angular/core'
import * as emver from '@start9labs/emver'
@Injectable({
providedIn: 'root',
})
export class Emver {
constructor() {}
compare(lhs: string, rhs: string): number {
if (!lhs || !rhs) return null
return emver.compare(lhs, rhs)
}
satisfies(version: string, range: string): boolean {
return emver.satisfies(version, range)
}
}