Install gcloud https://cloud.google.com/sdk/docs/install
Login and set project
gcloud init
| /** | |
| * Stores last emitted value in localStorage and replays if usStore$ is set. | |
| * If usStore$ is truthy then switches stream to use stored value. | |
| * If usStore$ is undefined then stream will emit as normal. | |
| * @param storageKey unique key to use in localStorage | |
| * @param useStore$ controls if the localStorage value is used | |
| */ | |
| export default function localStorageReplay<T>(storageKey: string, useStore$: BehaviorSubject<boolean>): MonoTypeOperatorFunction<T> { | |
| return (input$): Observable<T> => { |
| import { describe, it, expect, beforeEach } from 'vitest'; | |
| import { createBuilder, Builder } from './create-builder.factory'; | |
| // Example interface for testing | |
| interface Person { | |
| id: number; | |
| firstName: string; | |
| lastName: string; | |
| city?: string; | |
| } |
| /** | |
| * @license | |
| * Copyright (c) 2019 Jonathan Catmull. | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal | |
| * in the Software without restriction, including without limitation the rights | |
| * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| * copies of the Software, and to permit persons to whom the Software is | |
| * furnished to do so, subject to the following conditions: |
| import { Pipe, PipeTransform } from '@angular/core'; | |
| const ordinals: string[] = ['th','st','nd','rd']; | |
| /* | |
| * Append ordinal to number (e.g. "1st" position) | |
| * Usage: | |
| * value | ordinal:keepNumber | |
| * Example: | |
| * {{ 23 | ordinal}} |
Install gcloud https://cloud.google.com/sdk/docs/install
Login and set project
gcloud init
| /** | |
| * Gets the document type from a Firestore DocumentReference | |
| */ | |
| export type DocumentReferenceType<T> = T extends DocumentReference<infer U> ? U : never; |
| <div id="map-canvas-footer" style="height:300px; width:100%;" class="gMap" data-lat="<?php echo $location['lat']?>" data-lng="<?php echo $location['lng']?>"></div> |
| /** | |
| * Splits array when splitOn function returns true. Matched item will kept and be first in the subsequent child array. | |
| * @param items | |
| * @param splitOn | |
| */ | |
| export const splitArray = <T>( | |
| items: T[], | |
| splitOn: (item: T) => boolean, | |
| keepSplitItem = true | |
| ): T[][] => { |
| /** | |
| * Takes menu structure limits the number of levels of nesting. | |
| * @param menuItems | |
| * @param maxLevels | |
| * @param level | |
| */ | |
| export const truncateNesting = <T extends { children?: T[] }>( | |
| menuItems: T[], | |
| maxLevels: number, | |
| level = 1 |
| import { MonoTypeOperatorFunction, BehaviorSubject, Observable } from 'rxjs'; | |
| import { switchMapTo, tap, shareReplay } from 'rxjs/operators'; | |
| import JwtDecode from 'jwt-decode'; | |
| /** | |
| * Replays a JWT observable stream. If the JWT's exp passes then the source observable | |
| * will be re triggered automatically to get a new token. | |
| * This replays last value so the token will only update when it expires or because of an | |
| * upstream event, regardless of new subscriptions. Look up shareReplay() for more details. | |
| * @requires exp Token's must contain a exp to be used with this. |