https://github.com/drashland/accio
An easy way to search for deeply nested data in large datasets. Works in Node, Deno, and the browser.
https://github.com/drashland/accio
browser deno javascript node typescript
Last synced: 5 months ago
JSON representation
An easy way to search for deeply nested data in large datasets. Works in Node, Deno, and the browser.
- Host: GitHub
- URL: https://github.com/drashland/accio
- Owner: drashland
- Created: 2021-09-10T01:27:32.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-12-25T05:39:27.000Z (over 3 years ago)
- Last Synced: 2025-10-08T12:14:07.548Z (9 months ago)
- Topics: browser, deno, javascript, node, typescript
- Language: TypeScript
- Homepage:
- Size: 126 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Accio
An easy way to search for deeply nested data in large datasets
## Quickstart
The below quickstart uses Node and TypeScript. If this quickstart does not fit
your needs, check out the other guides below:
- [Quickstart: Browser - JavaScript](./docs/quickstart/browser_javascript.md)
- [Quickstart: Node - JavaScript](./docs/quickstart/node_javascript.md)
- [Quickstart: Deno - JavaScript](./docs/quickstart/deno_javascript.md)
- [Quickstart: Deno - TypeScript](./docs/quickstart/deno_typescript.md)
### Quickstart: Node - TypeScript
1. Initialize your project as a Node project.
```
$ npm init -y
```
_Note: `-y` skips all of the prompts._
2. Install Accio and the `ts-node` CLI.
```
$ npm install @drashland/accio
$ npm install -g ts-node
```
3. Create your `data.json` file. You can copy the
[`example_data.json`](./example_data.json) file from this repository.
4. Create your `app.ts` file.
```typescript
import { accio } from "@drashland/accio";
import { readFileSync } from "fs";
const data = readFileSync("./data.json", "utf-8");
const result = accio(data)
.array("versions") // Target the array named "versions"
.findOne({ // In the array, find one object that has a name field ...
name: "v0.0.3", // ... with the value of "v0.0.3"
})
.array("release_notes") // In the object, target the array named "release_notes"
.findOne({ // In the array, find one object that has a title field ...
title: "Bug Fixes", // ... with the value of "Bug Fixes"
})
.array("body") // In the object, target the array named "body"
.first(); // Target the first object in the array
// Create the typing for the result
type SomeType = {
type: string;
text: string;
};
// Use the `.get()` call and pass in the typing to get a typed result
const typedResult = result.get();
console.log(typedResult.type);
console.log(typedResult.text);
```
5. Run your `app.ts` file.
```
$ ts-node app.ts
```
You should see the following:
```
bullet
Fix issue with date objects not being correctly validated.
```
## Tutorials
- [Searching](./docs/tutorials/searching.md)
- [Traversing](./docs/tutorials/traversing.md)
## API
View the full API documentation [here](./docs/api_reference.md).
---
Want to contribute? Follow the Contributing Guidelines
[here](https://github.com/drashland/.github/blob/master/CONTRIBUTING.md). All
code is released under the
[MIT License](https://github.com/drashland/deno-drash/blob/main/LICENSE).