profile
viewpoint
Yuki Saito rokoucha @ggrel Tokyo https://rokoucha.net Otaku that scales

misskey-delta/misskey-web 6

improved MissKernel/Misskey-Web.

ci7lus/comic-meteor 3

RSS Feed Generator for comic-meteor.jp

ggrel/sibwive 1

Simple blog engine written in Vibe.d

infiniteloop-youth/rtx-monitoring 1

The most beautiful YAMAHA RTX series monitor

rokoucha/BBSreadphp 1

Simple "2channel" clone

rokoucha/ce-moneybook 1

Pocket money book application written in Ruby on rails

future-link/misskey-docker 0

Docker for Misskey-delta

infiniteloop-youth/notifook 0

notifook is watching you

infiniteloop-youth/reinigung 0

Auto clean up slack files

infiniteloop-youth/upping 0

Simple watchdogs

startedrinsuki/nicothumb2img

started time in 3 days

PR opened transform-ts/contrib

feat: JSON transformer
+39 -0

0 comment

3 changed files

pr created time in 16 days

create barnchtransform-ts/contrib

branch : feat/to_json

created branch time in 16 days

PR opened transform-ts/contrib

fix: Number() ではなく parseFloat() で数値かどうかパースする

Resolves #7 /^[+-]?\d+(\.\d+)?$/ みたいなチェックをかけないと 0xf0 になったり 1,2341 になったりしてしんどいかもしれない…

+3 -1

0 comment

1 changed file

pr created time in 16 days

Pull request review commenttransform-ts/contrib

feat: as-null と null-as を追加

+import { ok, Transformer } from 'transform-ts'++export const $emptyAsNull = Transformer.from<string, string | null>(text => (text === '' ? ok(null) : ok(text)))

ただ null-as の事を考えるとつらいかも…

rokoucha

comment created time in 16 days

PullRequestReviewEvent

Pull request review commenttransform-ts/contrib

feat: as-null と null-as を追加

+import { ok, Transformer } from 'transform-ts'++export const $emptyAsNull = Transformer.from<string, string | null>(text => (text === '' ? ok(null) : ok(text)))

https://github.com/transform-ts/contrib/blob/12fa2beff788491cbe3b939bc2bfbc91f97cd8bf/src/transformers/range.ts#L24 こいつと同じようにするか、したら compose で繋ぐようにしないとだね

rokoucha

comment created time in 16 days

PullRequestReviewEvent

PR opened transform-ts/contrib

feat: as-null と null-as を追加

Resolves #8

+52 -0

0 comment

3 changed files

pr created time in 16 days

create barnchtransform-ts/contrib

branch : feat/as_null_as

created branch time in 16 days

push eventtransform-ts/contrib

Rokoucha

commit sha b291fd1c2c67c368c8d027c1c8a9cf8dbb8e06a8

feat: dateString

view details

Rokoucha

commit sha 40617769ff95c495f077c40207cd6b84b8debb13

Merge remote-tracking branch 'origin/master' into refactor/date

view details

Rokoucha

commit sha e2a36e306162b7fc80b56699d029f15dd1fb12c2

docs: JSDoc で ISO 8601 を強く推奨

view details

Yuki Saito

commit sha 12fa2beff788491cbe3b939bc2bfbc91f97cd8bf

Merge pull request #2 from transform-ts/refactor/date feat: date transformers

view details

push time in 16 days

PR merged transform-ts/contrib

feat: date transformers
+62 -28

5 comments

5 changed files

rokoucha

pr closed time in 16 days

pull request commenttransform-ts/contrib

feat: date transformers

e2a36e3 ISO 8601™ 強く推奨

rokoucha

comment created time in 16 days

push eventtransform-ts/contrib

Rokoucha

commit sha 698f2e82af9ab23c6fead6e94775d25181e14989

feat: Range transformer

view details

Rokoucha

commit sha 65acf75b7b687d5b8ab1427df1d15e50c7240316

fix: レビュー対応

view details

Rokoucha

commit sha cb19a7d0396db3952ef85f25809bea012f8dae9c

fix: 外でスロー

view details

Rokoucha

commit sha a771cffc9639ab9f7c75152f8e423e24ea0a2952

fix: undefined チェックが抜けてた

view details

Rokoucha

commit sha c233f5011013babd90c05c4667d61962523cdbb3

fix: if を block に

view details

Rokoucha

commit sha 639f81058d225d7976f507258ca75b0c6226621b

fix: テストのパターンを良い感じに

view details

Yuki Saito

commit sha 4c4c030763b048693107e6b0a2016f82aa678aec

Merge pull request #1 from transform-ts/feat/range feat: Range transformer

view details

Rokoucha

commit sha 26bce0b76c7d6aa69c72475813956e499e85a921

fix: package.json の諸々を修正

view details

Rokoucha

commit sha b4b5c4a8d75e96b5cd9970e4c07c34280f04f5a2

chore: workflow の名前とファイル名前を統一

view details

Rokoucha

commit sha ef425624d811b7427025416f3cf22a29a269c1e0

fix: 改行削除

view details

Rokoucha

commit sha a71870fa7fd82037ea7c0cf0425e8b3f70eb775b

feat: release workflow

view details

Rokoucha

commit sha 5e1932032510f41e76af9e04860a90bd389ec28d

fix: 公開名を scoped に変更

view details

Rokoucha

commit sha 9489b34dba8a989ab8338039ccbe0552fbb713ab

fix: scoped パッケージなので public を明示する必要あり

view details

Rokoucha

commit sha d40b424d5750ec43808eac6a5ad359f6f27a8c0c

fix: prepublish を追加

view details

Rokoucha

commit sha 4ef6d2823655aeea9098dfdee13b1e7ed1306571

fix: non-interactive publish

view details

Yuki Saito

commit sha 08054408ac7c4526418736ccf735e89fbb2f7ca7

Merge pull request #3 from transform-ts/chore/ready_for_release chore: リリース準備

view details

Rokoucha

commit sha 40617769ff95c495f077c40207cd6b84b8debb13

Merge remote-tracking branch 'origin/master' into refactor/date

view details

Rokoucha

commit sha e2a36e306162b7fc80b56699d029f15dd1fb12c2

docs: JSDoc で ISO 8601 を強く推奨

view details

push time in 16 days

push eventrokoucha/mozuku

Rokoucha

commit sha 7180e32763edb3b7b5b0f9632a4b9bfa75f642ae

refactor: post-form を components 以下に移動

view details

Rokoucha

commit sha c03df120d849bded4111eff2cf4963682dee22c3

chore: LocalTimelinePanel を LocalTimelineLayout に

view details

Rokoucha

commit sha fb6fe34d3ee9d61c611fb5f0dc502f2b2c24734a

refactor: timeline を components 以下に移動

view details

Rokoucha

commit sha 553e07d2776e7ab3da02d0dc798a5cd17c7ee3a2

refactor: 新しく移行した Components の Props を export

view details

push time in 17 days

push eventrokoucha/mozuku

Rokoucha

commit sha 82a967df56665bbcaa756de3ceea4a6cbccbef2a

chore: LocalTimelinePage を LocalTimelinePanel に

view details

push time in 18 days

create barnchrokoucha/mozuku

branch : refactor/rewrite_local-timeline

created branch time in 18 days

startedpollinosis/delete-1kaguya-v3

started time in 18 days

push eventrokoucha/parcel-plugin-handlebars-passthrough

Rokoucha

commit sha 41371dd67657898a70333b1274422df775b6cd03

fix: Ignore handlebars expressions in assets path

view details

Rokoucha

commit sha 9b3305c6d0be18ecd8227726693ee3ca1c4529d4

fix: use strict pattern

view details

Rokoucha

commit sha 7599adcf7a89ab2212304f50f1f439f25d5c962e

fix: typo

view details

Rokoucha

commit sha 1cc52b8d45b258142abafb686f3c220b7b8392af

fix: Ignore dependecies which contain handlebars expression in anywhere

view details

Mikael Solstad

commit sha 7078f32fc981f054e9a00354dc23b40c0829eb80

Merge pull request #4 from rokoucha/fix/ignore-handlebars-expression-in-asset-paths fix: Not bundle if Handlebars expression is included in the asset path

view details

Mikael Solstad

commit sha 0fdb0695f41c5a08c7b340358e40bf5327462dc6

1.0.6

view details

push time in 22 days

startednextauthjs/next-auth

started time in 24 days

startedspeee/jsx-slack

started time in 24 days

startedKanDai/simple-qr-reader

started time in 24 days

issue openedtransform-ts/contrib

測れない物を弾くテスト

created time in a month

issue openedtransform-ts/contrib

空の文字列を null にする transformer

form の入力内容をバリデートする時に便利かも

created time in a month

issue openedtransform-ts/contrib

Number() じゃなくて parseFloat か何かで数値をパースする

16進数でパースされて嬉しい事ないでしょ

created time in a month

PullRequestReviewEvent

Pull request review commenttransform-ts/contrib

BREAKING CHANGE: $range が他 Transformer を受け付けないように

 export class OufOfMaxError extends Error {  export function $range<A extends { length: number } | number, B>(

B 貰わなくて良さそう

rinsuki

comment created time in a month

PullRequestReviewEvent
PullRequestReviewEvent

pull request commenttransform-ts/contrib

feat: date transformers

環境によって通るDateStringが違いそう。タイムゾーンなしISO8601なら適切な正規表現を通したほうが良いはず。名前もより適切なものにできるはずです

ISO 8601 は記法が柔軟なので正規表現を書くのがつらいといのがある

rokoucha

comment created time in a month

push eventrokoucha/penetrate-ts

Yuki Saito

commit sha 4eef9de68cdbb4e13be5e3bcd270d079108cc14a

docs: fix typo

view details

push time in a month

push eventrokoucha/template-ts

Rokoucha

commit sha eefc89c16067dfac8727c3c396766d17dbf7ed41

chore: remove unused env

view details

push time in a month

push eventrokoucha/template-ts

Rokoucha

commit sha c7edab03ca9bcb8767b5ff7fa4954df7fb2aa1ee

fix: npm badge

view details

push time in a month

push eventrokoucha/template-ts

Rokoucha

commit sha 4b68f5f07e82c33d86f1f4e8c3edb67186a34e16

fix: dont fix coverage

view details

Rokoucha

commit sha c17b525d87c8dd44186452147470d8c0e1069bc4

fix: typo test folder

view details

Rokoucha

commit sha 3e94b71bf2cf776aaf2ed96c36855b184fee33fe

fix: TS only

view details

push time in a month

push eventrokoucha/penetrate-ts

Rokoucha

commit sha e77adde0b5fa34f0331db748a1db985bf8b309af

fix: NPM badge

view details

Yuki Saito

commit sha d81273a4e30f09e66ee1264a185cc38db820946f

Merge pull request #2 from rokoucha/fix/npm-badge fix: NPM badge

view details

push time in a month

PR merged rokoucha/penetrate-ts

fix: NPM badge
+1 -1

1 comment

1 changed file

rokoucha

pr closed time in a month

PR opened rokoucha/penetrate-ts

fix: NPM badge
+1 -1

0 comment

1 changed file

pr created time in a month

create barnchrokoucha/penetrate-ts

branch : fix/npm-badge

created branch time in a month

created tagrokoucha/penetrate-ts

tag1.0.0

Let's make the strongest Dependency Injector only for you.

created time in a month

release rokoucha/penetrate-ts

1.0.0

released time in a month

delete branch rokoucha/penetrate-ts

delete branch : feat/ready_for_publish

delete time in a month

push eventrokoucha/penetrate-ts

Rokoucha

commit sha f3d2abd337299eaa39294284dec0e9d60165a4d1

First commit

view details

Rokoucha

commit sha 9d954b3d2890a6a6fa73219df4b56b0d96a484a0

feat: Ready for publish

view details

Rokoucha

commit sha 0b14a05e359453e62fd1ee21b6c5e3e5ae05f7b1

Merge remote-tracking branch 'origin/master' into feat/ready_for_publish

view details

Rokoucha

commit sha 5695a6ef5747751c9ffed711cc106e538cd97ea5

chore: Remove penetrator.ts

view details

Rokoucha

commit sha 61aebc57842520aa1475ec8e9aa1269a389c8bf5

docs: Write README.md

view details

Yuki Saito

commit sha 99469bffcb36d34a4c682e195c38f73d9a33c7eb

Merge pull request #1 from rokoucha/feat/ready_for_publish feat: Ready for publish

view details

push time in a month

push eventrokoucha/penetrate-ts

Rokoucha

commit sha 61aebc57842520aa1475ec8e9aa1269a389c8bf5

docs: Write README.md

view details

push time in a month

PR opened rokoucha/penetrate-ts

feat: Ready for publish
+5576 -87

0 comment

17 changed files

pr created time in a month

create barnchrokoucha/penetrate-ts

branch : feat/ready_for_publish

created branch time in a month

pull request commentmikaelrss/parcel-plugin-handlebars-passthrough

fix: Not bundle if Handlebars expression is included in the asset path

@mikaelrss Could you merge this PR?

rokoucha

comment created time in a month

push eventrokoucha/template-ts

Rokoucha

commit sha 1c157088ac096ec225ec66566e0a6a16c9402d8e

fix: prettier check

view details

push time in a month

create barnchrokoucha/template-ts

branch : master

created branch time in a month

created repositoryrokoucha/template-ts

TypeScript project template

created time in a month

issue openedtransform-ts/contrib

Bypass Actions when tag pushed

created time in a month

issue openedtransform-ts/contrib

Write README.md

created time in a month

release transform-ts/contrib

v1.0.0

released time in a month

created tagtransform-ts/contrib

tagv1.0.0

transform-ts contrib modules

created time in a month

push eventtransform-ts/contrib

Rokoucha

commit sha 26bce0b76c7d6aa69c72475813956e499e85a921

fix: package.json の諸々を修正

view details

Rokoucha

commit sha b4b5c4a8d75e96b5cd9970e4c07c34280f04f5a2

chore: workflow の名前とファイル名前を統一

view details

Rokoucha

commit sha ef425624d811b7427025416f3cf22a29a269c1e0

fix: 改行削除

view details

Rokoucha

commit sha a71870fa7fd82037ea7c0cf0425e8b3f70eb775b

feat: release workflow

view details

Rokoucha

commit sha 5e1932032510f41e76af9e04860a90bd389ec28d

fix: 公開名を scoped に変更

view details

Rokoucha

commit sha 9489b34dba8a989ab8338039ccbe0552fbb713ab

fix: scoped パッケージなので public を明示する必要あり

view details

Rokoucha

commit sha d40b424d5750ec43808eac6a5ad359f6f27a8c0c

fix: prepublish を追加

view details

Rokoucha

commit sha 4ef6d2823655aeea9098dfdee13b1e7ed1306571

fix: non-interactive publish

view details

Yuki Saito

commit sha 08054408ac7c4526418736ccf735e89fbb2f7ca7

Merge pull request #3 from transform-ts/chore/ready_for_release chore: リリース準備

view details

push time in a month

PR merged transform-ts/contrib

chore: リリース準備

Actions と package.json を整備

+35 -16

0 comment

3 changed files

rokoucha

pr closed time in a month

PullRequestReviewEvent

Pull request review commenttransform-ts/contrib

chore: リリース準備

+name: release+on:+  release:+    types: [created]+jobs:+  build:+    runs-on: ubuntu-latest+    steps:+    - uses: actions/checkout@v2+    - uses: actions/setup-node@v1+      with:+        node-version: '14.x'+        registry-url: 'https://registry.npmjs.org'+    - run: yarn install+    - run: yarn publish

--non-interactive オプションつけてみた

rokoucha

comment created time in a month

push eventtransform-ts/contrib

Rokoucha

commit sha 4ef6d2823655aeea9098dfdee13b1e7ed1306571

fix: non-interactive publish

view details

push time in a month

PullRequestReviewEvent

Pull request review commenttransform-ts/contrib

chore: リリース準備

+name: release+on:+  release:+    types: [created]+jobs:+  build:+    runs-on: ubuntu-latest+    steps:+    - uses: actions/checkout@v2+    - uses: actions/setup-node@v1+      with:+        node-version: '14.x'+        registry-url: 'https://registry.npmjs.org'+    - run: yarn install+    - run: yarn publish

うまく動かないので終わり

rokoucha

comment created time in a month

PullRequestReviewEvent

Pull request review commenttransform-ts/contrib

chore: リリース準備

+name: release+on:+  release:+    types: [created]+jobs:+  build:+    runs-on: ubuntu-latest+    steps:+    - uses: actions/checkout@v2+    - uses: actions/setup-node@v1+      with:+        node-version: '14.x'+        registry-url: 'https://registry.npmjs.org'+    - run: yarn install+    - run: yarn publish

fixed in d40b424

rokoucha

comment created time in a month

push eventtransform-ts/contrib

Rokoucha

commit sha d40b424d5750ec43808eac6a5ad359f6f27a8c0c

fix: prepublish を追加

view details

push time in a month

push eventtransform-ts/contrib

Rokoucha

commit sha 9489b34dba8a989ab8338039ccbe0552fbb713ab

fix: scoped パッケージなので public を明示する必要あり

view details

push time in a month

push eventtransform-ts/contrib

Rokoucha

commit sha 5e1932032510f41e76af9e04860a90bd389ec28d

fix: 公開名を scoped に変更

view details

push time in a month

PR opened transform-ts/contrib

chore: リリース準備

Actions と package.json を整備

+28 -13

0 comment

3 changed files

pr created time in a month

create barnchtransform-ts/contrib

branch : chore/ready_for_release

created branch time in a month

pull request commentlinkage-community/mozuku

feat: 投稿欄の上にリプライ欄を追加

* アイコンタップでリプライ先に指定って初見だと分からなかった、今まではボタンが出てたのでどちらの方がいいのか…

* リプライ先の投稿の長さでアイコンサイズがガタガタするっぽい
  
  * ![image](https://user-images.githubusercontent.com/6058487/93665208-aa345a80-faaf-11ea-8e30-094f40843ae1.png)
  * ![image](https://user-images.githubusercontent.com/6058487/93665213-b3252c00-faaf-11ea-918e-d1598670585a.png)

* アイコン未登録のアカウントの表示がタイムラインと違う
  
  * ![image](https://user-images.githubusercontent.com/6058487/93665284-3777af00-fab0-11ea-8c67-f0e3ba7416b1.png)

直っていて良いと思った(こなみ)

ci7lus

comment created time in a month

push eventtransform-ts/contrib

Rokoucha

commit sha 698f2e82af9ab23c6fead6e94775d25181e14989

feat: Range transformer

view details

Rokoucha

commit sha 65acf75b7b687d5b8ab1427df1d15e50c7240316

fix: レビュー対応

view details

Rokoucha

commit sha cb19a7d0396db3952ef85f25809bea012f8dae9c

fix: 外でスロー

view details

Rokoucha

commit sha a771cffc9639ab9f7c75152f8e423e24ea0a2952

fix: undefined チェックが抜けてた

view details

Rokoucha

commit sha c233f5011013babd90c05c4667d61962523cdbb3

fix: if を block に

view details

Rokoucha

commit sha 639f81058d225d7976f507258ca75b0c6226621b

fix: テストのパターンを良い感じに

view details

Yuki Saito

commit sha 4c4c030763b048693107e6b0a2016f82aa678aec

Merge pull request #1 from transform-ts/feat/range feat: Range transformer

view details

push time in a month

PR merged transform-ts/contrib

feat: Range transformer
+133 -0

3 comments

3 changed files

rokoucha

pr closed time in a month

pull request commentlinkage-community/mozuku

feat: 投稿欄の上にリプライ欄を追加

  • アイコンタップでリプライ先に指定って初見だと分からなかった、今まではボタンが出てたのでどちらの方がいいのか…
  • リプライ先の投稿の長さでアイコンサイズがガタガタするっぽい
    • image
    • image
  • アイコン未登録のアカウントの表示がタイムラインと違う
    • image
ci7lus

comment created time in a month

PullRequestReviewEvent

Pull request review commenttransform-ts/contrib

feat: Range transformer

+import $, { error, ok, ValidationError } from 'transform-ts'+import { $range, InvalidRangeError, OufOfMaxError, OufOfMinError } from '../..'++describe('invalid range', () => {+  it('throws InvalidRangeError', () => {+    expect(() => $range({ min: 2, max: 1 }, $.number).transform(1)).toThrow(new InvalidRangeError(2, 1))+  })+})++describe('Number', () => {+  it('throws OufOfMinError', () => {+    expect($range({ min: 1, max: 3 }, $.number).transform(0)).toEqual(+      error(ValidationError.from(new OufOfMinError(0, 1))),+    )+  })++  it('success validation with equal to the min value', () => {+    expect($range({ min: 1, max: 3 }, $.number).transform(1)).toEqual(ok(1))+  })++  it('success validation between the min and max values', () => {+    expect($range({ min: 1, max: 3 }, $.number).transform(2)).toEqual(ok(2))+  })++  it('success validation with equal to the max value', () => {+    expect($range({ min: 1, max: 3 }, $.number).transform(3)).toEqual(ok(3))+  })++  it('throws OufOfMaxError', () => {+    expect($range({ min: 1, max: 3 }, $.number).transform(4)).toEqual(+      error(ValidationError.from(new OufOfMaxError(4, 3))),+    )+  })+})++describe('String', () => {+  it('throws OufOfMinError', () => {+    expect($range({ min: 1, max: 3 }, $.string).transform('')).toEqual(+      error(ValidationError.from(new OufOfMinError(0, 1))),+    )+  })++  it('success validation with equal to the min value', () => {+    expect($range({ min: 1, max: 3 }, $.string).transform('a')).toEqual(ok('a'))+  })++  it('success validation between the min and max values', () => {+    expect($range({ min: 1, max: 3 }, $.string).transform('ab')).toEqual(ok('ab'))+  })++  it('success validation with equal to the max value', () => {+    expect($range({ min: 1, max: 3 }, $.string).transform('abc')).toEqual(ok('abc'))+  })++  it('throws OufOfMaxError', () => {+    expect($range({ min: 1, max: 3 }, $.string).transform('abcd')).toEqual(+      error(ValidationError.from(new OufOfMaxError(4, 3))),+    )+  })+})++describe('Array', () => {+  it('throws OufOfMinError', () => {+    expect($range({ min: 1, max: 3 }, $.array($.string)).transform([])).toEqual(+      error(ValidationError.from(new OufOfMinError(0, 1))),+    )+  })++  it('success validation with equal to the min value', () => {+    expect($range({ min: 1, max: 3 }, $.array($.string)).transform(['a'])).toEqual(ok(['a']))+  })++  it('success validation between the min and max values', () => {+    expect($range({ min: 1, max: 3 }, $.array($.string)).transform(['a', 'b'])).toEqual(ok(['a', 'b']))+  })++  it('success validation with equal to the max value', () => {+    expect($range({ min: 1, max: 3 }, $.array($.string)).transform(['a', 'b', 'c'])).toEqual(ok(['a', 'b', 'c']))+  })++  it('throws OufOfMaxError', () => {+    expect($range({ min: 1, max: 3 }, $.array($.string)).transform(['a', 'b', 'c', 'd'])).toEqual(+      error(ValidationError.from(new OufOfMaxError(4, 3))),+    )+  })+})

639f810 でちょっと改善してみた(手抜き)

rokoucha

comment created time in a month

push eventtransform-ts/contrib

Rokoucha

commit sha cb19a7d0396db3952ef85f25809bea012f8dae9c

fix: 外でスロー

view details

Rokoucha

commit sha a771cffc9639ab9f7c75152f8e423e24ea0a2952

fix: undefined チェックが抜けてた

view details

Rokoucha

commit sha c233f5011013babd90c05c4667d61962523cdbb3

fix: if を block に

view details

Rokoucha

commit sha 639f81058d225d7976f507258ca75b0c6226621b

fix: テストのパターンを良い感じに

view details

push time in a month

Pull request review commenttransform-ts/contrib

feat: Range transformer

+import { error, Transformer, ValidationError } from 'transform-ts'++export class UndefinedRangeError extends Error {+  constructor() {+    super(`min and max is undefined.`)+    this.name = 'UndefinedRangeError'+  }+}++export class InvalidRangeError extends Error {+  constructor(readonly min: number, readonly max: number) {+    super(`min "${min}" must be equal to or less than max "${max}"`)+    this.name = 'InvalidRangeError'+  }+}++export class OufOfMinError extends Error {+  constructor(readonly length: number, readonly range: number) {+    super(`length "${length}" must be equal to or greater than min "${range}"`)+    this.name = 'OufOfMinError'+  }+}++export class OufOfMaxError extends Error {+  constructor(readonly length: number, readonly range: number) {+    super(`length "${length}" must be equal to or less than min "${range}"`)+    this.name = 'OufOfMaxError'+  }+}++export function $range<A>(+  f: Transformer<number | string | Array<any>, A>,+  { min, max }: { min?: number; max?: number },+): Transformer<number | string | Array<any>, A> {+  return Transformer.from<number | string | Array<any>, A>(u => {

https://github.com/transform-ts/contrib/pull/1#discussion_r490951595

rokoucha

comment created time in a month

PullRequestReviewEvent

Pull request review commenttransform-ts/contrib

feat: Range transformer

+import { error, Transformer, ValidationError } from 'transform-ts'++export class UndefinedRangeError extends Error {+  constructor() {+    super(`min and max is undefined.`)+    this.name = 'UndefinedRangeError'+  }+}++export class InvalidRangeError extends Error {+  constructor(readonly min: number, readonly max: number) {+    super(`min "${min}" must be equal to or less than max "${max}"`)+    this.name = 'InvalidRangeError'+  }+}++export class OufOfMinError extends Error {+  constructor(readonly length: number, readonly range: number) {+    super(`length "${length}" must be equal to or greater than min "${range}"`)+    this.name = 'OufOfMinError'+  }+}++export class OufOfMaxError extends Error {+  constructor(readonly length: number, readonly range: number) {+    super(`length "${length}" must be equal to or less than min "${range}"`)+    this.name = 'OufOfMaxError'+  }+}++export function $range<A>(+  f: Transformer<number | string | Array<any>, A>,+  { min, max }: { min?: number; max?: number },+): Transformer<number | string | Array<any>, A> {

const c: number | { length: number } = u してあげるとちゃんと型がつくのでそれで対応した

rokoucha

comment created time in a month

PullRequestReviewEvent

Pull request review commenttransform-ts/contrib

feat: Range transformer

+import { error, Transformer, ValidationError } from 'transform-ts'++export class UndefinedRangeError extends Error {+  constructor() {+    super(`min and max is undefined.`)+    this.name = 'UndefinedRangeError'+  }+}++export class InvalidRangeError extends Error {+  constructor(readonly min: number, readonly max: number) {+    super(`min "${min}" must be equal to or less than max "${max}"`)+    this.name = 'InvalidRangeError'+  }+}++export class OufOfMinError extends Error {+  constructor(readonly length: number, readonly range: number) {+    super(`length "${length}" must be equal to or greater than min "${range}"`)+    this.name = 'OufOfMinError'+  }+}++export class OufOfMaxError extends Error {+  constructor(readonly length: number, readonly range: number) {+    super(`length "${length}" must be equal to or less than min "${range}"`)+    this.name = 'OufOfMaxError'+  }+}++export function $range<A>(+  f: Transformer<number | string | Array<any>, A>,+  { min, max }: { min?: number; max?: number },+): Transformer<number | string | Array<any>, A> {

https://github.com/transform-ts/contrib/blob/36bbeed14ee25b0cfa1f091d05eca83524a9835b/src/transformers/range.ts#L42 でやってみたけど typeof u === 'number' の上で else if してるのに uA extends number | { length: number} のままで typegurad が効かない… ていうかこの式は

rokoucha

comment created time in a month

PullRequestReviewEvent

push eventtransform-ts/contrib

Rokoucha

commit sha 65acf75b7b687d5b8ab1427df1d15e50c7240316

fix: レビュー対応

view details

push time in a month

Pull request review commenttransform-ts/contrib

feat: Range transformer

+import { error, Transformer, ValidationError } from 'transform-ts'++export class UndefinedRangeError extends Error {+  constructor() {+    super(`min and max is undefined.`)+    this.name = 'UndefinedRangeError'+  }+}++export class InvalidRangeError extends Error {+  constructor(readonly min: number, readonly max: number) {+    super(`min "${min}" must be equal to or less than max "${max}"`)+    this.name = 'InvalidRangeError'+  }+}++export class OufOfMinError extends Error {+  constructor(readonly length: number, readonly range: number) {+    super(`length "${length}" must be equal to or greater than min "${range}"`)+    this.name = 'OufOfMinError'+  }+}++export class OufOfMaxError extends Error {+  constructor(readonly length: number, readonly range: number) {+    super(`length "${length}" must be equal to or less than min "${range}"`)+    this.name = 'OufOfMaxError'+  }+}++export function $range<A>(+  f: Transformer<number | string | Array<any>, A>,+  { min, max }: { min?: number; max?: number },+): Transformer<number | string | Array<any>, A> {+  return Transformer.from<number | string | Array<any>, A>(u => {+    if (!min && !max) return error(ValidationError.from(new UndefinedRangeError()))

引数の型を union にして undefined かどうかを判定するようにした

rokoucha

comment created time in a month

PullRequestReviewEvent

Pull request review commenttransform-ts/contrib

feat: Range transformer

+import { error, Transformer, ValidationError } from 'transform-ts'++export class UndefinedRangeError extends Error {+  constructor() {+    super(`min and max is undefined.`)+    this.name = 'UndefinedRangeError'+  }+}++export class InvalidRangeError extends Error {+  constructor(readonly min: number, readonly max: number) {+    super(`min "${min}" must be equal to or less than max "${max}"`)+    this.name = 'InvalidRangeError'+  }+}++export class OufOfMinError extends Error {+  constructor(readonly length: number, readonly range: number) {+    super(`length "${length}" must be equal to or greater than min "${range}"`)+    this.name = 'OufOfMinError'+  }+}++export class OufOfMaxError extends Error {+  constructor(readonly length: number, readonly range: number) {+    super(`length "${length}" must be equal to or less than min "${range}"`)+    this.name = 'OufOfMaxError'+  }+}++export function $range<A>(+  f: Transformer<number | string | Array<any>, A>,+  { min, max }: { min?: number; max?: number },+): Transformer<number | string | Array<any>, A> {+  return Transformer.from<number | string | Array<any>, A>(u => {+    if (!min && !max) return error(ValidationError.from(new UndefinedRangeError()))+    if (min && max && max < min) return error(ValidationError.from(new InvalidRangeError(min, max)))

throw するようにした

rokoucha

comment created time in a month

PullRequestReviewEvent

Pull request review commenttransform-ts/contrib

feat: Range transformer

+import $, { error, ok, ValidationError } from 'transform-ts'+import { $range, InvalidRangeError, OufOfMaxError, OufOfMinError, UndefinedRangeError } from '../..'++describe('invalid range', () => {+  it('throws UndefinedRangeError', () => {+    expect($range($.number, {}).transform(1)).toEqual(error(ValidationError.from(new UndefinedRangeError())))

https://github.com/transform-ts/contrib/pull/1#discussion_r490704818 で解決できたのでそのようにした

rokoucha

comment created time in a month

PullRequestReviewEvent

push eventtransform-ts/contrib

Rokoucha

commit sha 36bbeed14ee25b0cfa1f091d05eca83524a9835b

WIP: fix: レビュー対応

view details

push time in a month

PR opened transform-ts/contrib

feat: date transformers
+39 -15

0 comment

4 changed files

pr created time in a month

pull request commenttransform-ts/contrib

feat: Range transformer

@tosuke 関係ないコミットを削除してテスト整備 rebase しました

rokoucha

comment created time in a month

push eventtransform-ts/contrib

Rokoucha

commit sha 698f2e82af9ab23c6fead6e94775d25181e14989

feat: Range transformer

view details

push time in a month

push eventtransform-ts/contrib

push time in a month

create barnchtransform-ts/contrib

branch : refactor/date

created branch time in a month

pull request commenttransform-ts/contrib

wip: $range

anyなのが気になるな…ちゃんとしたレビューはあとでやる

string | number | any[] な transformer を受け取れるようにした

TODO: b7a9d9e は別 PR に cherry-pick する

rokoucha

comment created time in a month

push eventtransform-ts/contrib

Rokoucha

commit sha 14b0d34d06e88967dca9bb30b161038d4b4cc99f

fix: Transformer を貰う

view details

Rokoucha

commit sha b7a9d9e261d22c1e7809527db595c7e99af73f5b

feat: dateString

view details

push time in a month

PR opened transform-ts/contrib

Reviewers
wip: $range
+84 -0

0 comment

3 changed files

pr created time in a month

more