Entries from 2017-06-28 to 1 day

カラーコードの変換 (Hex -> RGB)

例えば#ff0000をrgb(255,0,0)に変換したい場合。 カラーコード(文字列)を2文字ずつに分ける 16進法を10進法に変換する import compose from 'lodash/fp/compose'; import map from 'lodash/fp/map'; function hexToRgb(hex: string): string { return comp…

null vs undefined

undefinedを使うべきかnullを使うべきか。コンテキストで使い分けるべきか。 Coding guidelines · Microsoft/TypeScript Wiki · GitHub contributors向けのガイド。undefinedを使えとのこと。 Rule: no-null-keyword TSLintにルールもある。