1.3.0 • Published 2 years ago

@drashland/accio v1.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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: 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 file from this repository.

  4. Create your app.ts file.

    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<SomeType>();
    
    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

API

View the full API documentation here.


Want to contribute? Follow the Contributing Guidelines here. All code is released under the MIT License.

1.3.0

2 years ago

1.2.0

3 years ago

1.2.0-alpha-1

3 years ago

1.2.0-alpha-2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.1.2

3 years ago

1.1.0-alpha-1

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago