$ npm i nodemailer
$ npm i -D @types/nodemailer
This file contains hidden or 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
/** | |
* @link https://ultimatecourses.com/blog/reverse-object-keys-and-values-in-javascript | |
* @example | |
* const swapped = objectSwap({ x: 1, y: 2 }) // { 1: 'x', 2: 'y' } | |
* ^^^^^^^ infer Record<1 | 2, 'x' | 'y'> | |
*/ | |
export const objectSwap = < | |
T extends PropertyKey, | |
U extends PropertyKey, | |
>(object: Record<T, U>) => Object.fromEntries( |
This file contains hidden or 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
/** | |
* Force infer object prop with check by Object.hasOwn | |
* | |
* @link https://github.com/microsoft/TypeScript/issues/47450#issuecomment-1013737149 | |
* @link https://javascript.plainenglish.io/in-vs-hasown-vs-hasownproperty-in-javascript-885771d2d100 | |
* | |
* @example | |
* const myObject = { hello: 'world' } | |
* const input = prompt('enter key')! | |
* |
This file contains hidden or 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 React, { ReactNode } from 'react' | |
import { Box, Divider, VStack } from '@chakra-ui/layout' | |
import { ChakraProps } from '@chakra-ui/system' | |
/** | |
* ↓ みたいなやつ作りたい時用 | |
* | |
* item1 | |
* ------- | |
* item2 |
github.com/maildev/maildev
maildev (SMTP mock server) を使ってハイパーメール開発
$ npm i -D maildev
$ npx maildev --ip localhost
> MailDev using directory /var/folders/2h/c616w1013n99fpgzz9gw7cx80000gn/T/maildev-16834
> MailDev webapp running at http://localhost:1080
This file contains hidden or 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
/** | |
* @link https://qiita.com/nagtkk/items/e1cc3f929b61b1882bd1 | |
* @example | |
* const result = groupBy(users, user => user.role) | |
* .filter(([role, _users]) => role === 'admin') | |
*/ | |
export const groupBy = <K, V>( | |
array: readonly V[], | |
getKey: (cur: V, idx: number, src: readonly V[]) => K | |
): [K, V[]][] => |
- https://github.com/snd-lib/snd-lib
- https://snd.dev/
- https://zenn.dev/doke/articles/880f03c35576b5
$ npm i snd-lib
// libs/snd-lib.ts
- react でそのまま使える video, audio 再生プレイヤー
- youtube などの映像サービスに広く対応
- 普通に cdn に置いてあるファイルを読んだりとかも ok
$ npm i react-player
This file contains hidden or 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
/** | |
* type inferable Object.keys | |
* | |
* NOTE key が number な型定義だと number[] になりつつ | |
* 「 js の object key は全て string 」という仕様で | |
* string[] になるので、後続で map(Number) など必要 | |
*/ | |
export const objectKeys = <T extends object>(target: T): (keyof T)[] => ( | |
Object.keys(target).map(key => key as keyof T) | |
) |
This file contains hidden or 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
/** | |
* https://github.com/epoberezkin/fast-deep-equal | |
*/ | |
import equal from 'fast-deep-equal' | |
/** | |
* rxjs で complex な state の前後比較のため | |
* distinctUntilChanged に食わせる想定の | |
* array, object 対応な深い比較用 callback | |
*/ |