This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const isDefined = <T>(value: T): value is NonNullable<T> => value !== undefined && value !== null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HttpClient } from '@angular/common/http'; | |
import { Directive, ElementRef, Injectable, Input, OnInit } from '@angular/core'; | |
import { map, Observable, shareReplay } from 'rxjs'; | |
@Injectable({ | |
providedIn: 'root', | |
}) | |
class CacheImageService { | |
imageRequests$: Map<string, Observable<string>> = new Map(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ArrayUtils { | |
static chunk<T>(array: T[], chunkSize: number): T[][] { | |
const chunks: T[][] = []; | |
let index = 0; | |
while (index < array.length) { | |
chunks.push(array.slice(index, index + chunkSize)); | |
index += chunkSize; | |
} | |
return chunks; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os from 'os'; | |
import { name, version } from '../package.json'; | |
export class InformationLogger { | |
static logApplicationInformation(): void { | |
console.log({ | |
application: { | |
name, | |
version, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"target": "esnext", | |
"module": "esnext", | |
"moduleResolution": "node", | |
"lib": ["dom", "es2018"], | |
"allowSyntheticDefaultImports": true, | |
"noUnusedLocals":true, | |
"removeComments": true, | |
"resolveJsonModule": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const NodemonPlugin = require('nodemon-webpack-plugin'); | |
module.exports = (env = {}) => { | |
const config = { | |
entry: ['./src/main.ts'], // Let's change our entry file's extension to '.ts' | |
mode: env.development ? 'development' : 'production', | |
target: 'node', | |
devtool: env.development ? 'cheap-eval-source-map' : false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "node-typescript", | |
"version": "0.0.1", | |
"author": "Freek Mencke", | |
"homepage": "https://medium.com/@freek_mencke", | |
"license": "MIT", | |
"scripts": { | |
"start": "webpack --progress --env.development --env.nodemon", | |
"start:prod": "webpack --progress --env.nodemon", | |
"build": "webpack --progress --env.development", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const NodemonPlugin = require('nodemon-webpack-plugin'); | |
module.exports = (env = {}) => { | |
const config = { | |
entry: ['./src/main.js'], | |
mode: env.development ? 'development' : 'production', | |
target: 'node', | |
devtool: env.development ? 'inline-source-map' : false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "node-typescript", | |
"version": "0.0.1", | |
"author": "Freek Mencke", | |
"homepage": "https://medium.com/@freek_mencke", | |
"license": "MIT", | |
"scripts": { | |
"start": "webpack --progress --env.development", | |
"start:prod": "webpack --progress" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = (env = {}) => { | |
const config = { | |
entry: ['./src/main.js'], | |
mode: env.development ? 'development' : 'production', | |
target: 'node', | |
// devtool alternatives: 'cheap-module-eval-source-map' (faster, less details) or 'cheap-eval-source-map' (fastest, even less details) | |
devtool: env.development ? 'inline-source-map' : false, | |
}; |
NewerOlder