@titicaca/triple-url-utilities
TypeScript icon, indicating that this package has built-in type declarations

6.4.0 • Public • Published

Triple URL Utilities

URL 관련 유틸성 라이브러리를 제공합니다.

Installation

npm으로 설치합니다:

$ npm install @titicaca/triple-url-utilities

strict-query

query-string으로 주어진 값의 타입을 결정하여 사용할 수 있게 도와주는 인터페이스.

import { strictQuery } from '@titicaca/triple-url-utilities'

const { regionId, tripId, categoryIds, agesOfChildren, inRegion } = strictQuery(
  query,
)
  .string('regionId') // regionId will be string | undefined
  .number('tripId') // tripId will be number | undefined
  .stringArray('categoryIds') // categoryIds will be string[] | undefined
  .numberArray('agesOfChildren') // agesOfChildren will be number[] | undefined
  .boolean('inRegion') // inRegion will be boolean | undefined
  .use()

strictQuery 함수를 이용해 속성과 타입을 매핑할 수 있는 인스턴스로 바꿔줍니다. 그 다음 원하는 타입과 속성 키를 매핑해줍니다. chaining으로 여러 속성을 한 번에 매핑할 수 있습니다. 그리고 use 메서드를 이용해 일반 객체를 반환해주면 원하는 타입으로 사용할 수 있습니다.

Readme

Keywords

none

Package Sidebar

Install

npm i @titicaca/triple-url-utilities

Weekly Downloads

492

Version

6.4.0

License

ISC

Unpacked Size

23.8 kB

Total Files

6

Last publish

Collaborators

  • seyeon25
  • dy604160
  • nuri1224
  • teddy23
  • south94
  • pbh92
  • okh01
  • clearsky1015
  • jinyung
  • kbg2
  • sejong.chae
  • kmkim
  • cosmiceyez23
  • hankwanyong
  • yejikk
  • yunsoomin
  • jran12
  • noah95
  • jason91
  • garlicsource
  • devravit
  • int_robben
  • ponykit
  • psg107
  • shin0723
  • daisy-rec
  • eddie-int
  • jayden92
  • leejunhyuck
  • lunychu
  • jungwoo.interpark
  • cu_kim
  • hwangjungmin
  • hari21
  • mcpark
  • raitei0330
  • lucy0327
  • influx08
  • ben-youngho
  • audreyoon
  • jimmy_triple
  • kidol
  • dia-triple
  • miya1
  • jinsol-kim
  • watsonpark
  • teo-triple
  • donup088
  • litsynp
  • hoolie
  • moomoo95
  • triple-dominic
  • jarry-triple
  • ronnie48
  • jhyj0521
  • hannah-triple
  • triple-ronnie
  • hailey-triple
  • maeve.triple
  • doncic
  • triple-demian
  • owen95
  • ywtechit
  • jonghodev
  • guswl
  • rita913
  • odile-triple
  • greeenly
  • portfolio-y0711
  • holy
  • kyudeok
  • heron-triple
  • inbeom
  • dincal
  • triple-corp
  • judetriple
  • bruce-00
  • sirokim
  • david-triple
  • torres-god
  • jay-triple
  • simonz
  • how3
  • pode
  • triple-steve
  • hans-triple
  • eugene-triple
  • kage.kim
  • hancock-triple
  • lucas-triple
  • zoe_
  • robby-triple
  • triple-young
  • triple-ben
  • zhsks528