Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/giacomorebonato/parse-json-with-dates
A small utility that parses JSON and converts date fields to Date type.
https://github.com/giacomorebonato/parse-json-with-dates
Last synced: 2 days ago
JSON representation
A small utility that parses JSON and converts date fields to Date type.
- Host: GitHub
- URL: https://github.com/giacomorebonato/parse-json-with-dates
- Owner: giacomorebonato
- License: mit
- Created: 2021-01-04T17:05:24.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-01-10T17:52:43.000Z (almost 4 years ago)
- Last Synced: 2024-04-10T20:17:59.076Z (7 months ago)
- Language: TypeScript
- Size: 270 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: license
Awesome Lists containing this project
README
# parse-json-with-dates
| Statements | Branches | Functions | Lines |
| ------------------------- | ----------------------- | ------------------------ | -------------------- |
| ![Statements](https://img.shields.io/badge/Coverage-92.31%25-brightgreen.svg) | ![Branches](https://img.shields.io/badge/Coverage-83.33%25-yellow.svg) | ![Functions](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg) | ![Lines](https://img.shields.io/badge/Coverage-90.91%25-brightgreen.svg) |A small utility that parses JSON and converts date fields to Date type.
[Documentation](./docs/modules.md)
**Example**
```js
import { parseJsonWithDates } from 'parse-json-with-dates'const parsed = parseJsonWithDates(
JSON.stringify({ 'date-field': new Date() }),
['date-field']
)parsed.a.toISOString() // it's a date!
``````typescript
import { parseJsonWithDates } from 'parse-json-with-dates'type MyDate = {
a: Date
}const parsed = parseJsonWithDates(
JSON.stringify({ 'date-field': new Date() }),
['date-field']
)parsed.a.toISOString() // it's a date!
```