Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jackall3n/query-parsed
A library for query string type coercion
https://github.com/jackall3n/query-parsed
Last synced: 4 days ago
JSON representation
A library for query string type coercion
- Host: GitHub
- URL: https://github.com/jackall3n/query-parsed
- Owner: jackall3n
- Created: 2022-05-16T09:07:43.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T17:24:08.000Z (about 1 year ago)
- Last Synced: 2024-12-10T03:54:47.989Z (29 days ago)
- Language: TypeScript
- Homepage: https://npmjs.com/package/query-parsed
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# query-parsed 🔎
## Blurb
A library for query string type coercion
## Installation
```shell
npm install query-parsed
``````shell
yarn add query-parsed
```## Usage
### Parsed
```typescript
import queryparse from 'query-parsed';// Return Type = { test: number }
const parsed = queryparse.parse("test=1", { test: Number });
```### Arrays
```typescript
import queryparse from 'query-parsed';// Return Type = { test: number[] }
const parsed = queryparse.parse("test=1,2", { test: [Number] }, { arrayFormat: "comma" });
```### Typed
```typescript
import queryparse from 'query-parsed';// Return Type = { test: string }
const parsed = queryparse.parse<{ test: string }>("test=1");
```### Default
```typescript
import queryparse from 'query-parsed';// Return Type = Record
const parsed = queryparse.parse("test=1");
```## API
### Supported Parse Types
```typescript
String | Boolean | Number
```