How to use the codelyzer/util/isNotNullOrUndefined.isNotNullOrUndefined function in codelyzer

To help you get started, we’ve selected a few codelyzer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github w11k / angular-sticky-things / projects / angular-sticky-things / src / lib / sticky-thing.directive.ts View on Github external
private determineStatus(originalVals: StickyPositions, pageYOffset: number, marginTop: number, marginBottom: number, enabled: boolean) {
    const elementPos = this.determineElementOffsets();
    let isSticky = enabled && pageYOffset > originalVals.offsetY;
    if (pageYOffset < this.elementOffsetY) {
      isSticky = false;
    }
    const stickyElementHeight = this.getComputedStyle(this.stickyElement.nativeElement).height;
    const reachedLowerEdge = isNotNullOrUndefined(this.boundaryElement) ? this.boundaryElement && window.pageYOffset + stickyElementHeight + marginBottom >= (originalVals.bottomBoundary - marginTop * 1.0) : undefined;
    const reachedUpperEdge = isNotNullOrUndefined(this.boundaryElement) ? window.pageYOffset < (this.boundaryElement.offsetTop + marginTop * 1.0) : undefined;
    this.stickyPosition.emit({...elementPos, upperScreenEdgeAt: pageYOffset, marginBottom, marginTop});
    return {
      isSticky,
      reachedUpperEdge,
      reachedLowerEdge,
    };

  }