Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akarachen/json-import
https://github.com/akarachen/json-import
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/akarachen/json-import
- Owner: AkaraChen
- Created: 2024-01-15T06:08:50.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-01-15T06:38:52.000Z (10 months ago)
- Last Synced: 2024-10-24T03:59:28.996Z (14 days ago)
- Language: TypeScript
- Size: 49.8 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# json-import
> JUST A JOKE, DO NOT THINK ABOUT IT
Now you can use json as a store.
```js
import json from './test.json' with { type: 'json' }if (!json.a) {
json.a = [0]
}json.a.push(json.a.at(-1) + 1)
``````json
// test.json
{
"a": [0, 1, 2, 3, 4, 5]
}
```## Installation
```bash
# no, I haven't published it yet
# maybe it shouldn't be published
```## Usage
At first, you need to configure babel.
See [.babelrc](./examples/simple/.babelrc)
Then, you can import json files.
```js
import json from './test.json' with { type: 'json' }// you can do anything you want
json.b = {
c: 1
}json.a = [0]
json.a.splice(1, 0, 1)
```