npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

result-builder

v1.1.3

Published

A library that allows tool developers to easily build and format result sets in Koalati tools, using the validation format defined in the [contributor documentation](https://docs.koalati.com/).

Downloads

4

Readme

Result Builder library for Koalati tools

A library that allows tool developers to easily build and format result sets in Koalati tools, using the validation format defined in the contributor documentation.

Setup / Installation

  • Make sure NodeJs is installed
  • Install the package using the npm install command
npm i result-builder

Usage

Then, you can include it in your project and use like this

const ResultBuilder = require('result-builder')
//...
const resultsBuilder = new ResultBuilder(); 
const test = resultsBuilder.newTest('test-unique-name');
test.setTitle("my-title")
    .setDescription("my-description")
    .setWeight(0.5)
    .setScore(0.5)
    .addRecommendation("my-recommendation")
    .addSnippet(["my-snippet"])
    .addTableRow([
        [
            "Table heading 1",
            "Table heading 2"
        ],
        [
            "Table value 1",
            "Table value 2"
        ]
    ])
// ... 
return resultsBuilder.getResultsTests(); 

List of methods and functions

ResultBuilder class

| Methods | Descriptions | | :---------------- | :--------------------------------------------------------- | | newTest(string) | Allow to set up a new test by providing a test unique name | | getResultsTests() | Allow to get all the list of all the recorded tests | | toJson() | Convert the result to a JSON format | | toArray() | Convert all the results into an array |

Test class

| Methods | Descriptions | | :--------------------------------- | :------------------------------- | | addRecommendation(string) | Allows you to add recommendations indicating to the user improvements to be made. Only strings are accepted. | | addSnippet(string|ElementHandle | Allows you to add code snippets from the results obtained.| | addSnippets(array) | Allows you to add many code snippets from the results obtained.| | addTableRow(array) | Allows you to add a row to a data table. The first row will act as the table's header. Every row must have the same number of columns. | | addTableRows(array) | Allows you to add many rows to a data table.| | setTitle(string) | Allow tou to add a user-friendly title. Only strings are accepted. | | setDescription(string) | Allow you to add a user-friendly description of the test. Only strings are accepted. | | setWeight(number) | allows you to add the value of the test weight. Only numbers between 0.0 and 1.0. | | setScore(float) | allows you to add the value of the test score. Only numbers between 0.0 and 1.0. | | getTitle() | Allow you to get the title of the test. | | getDescription() | Allow you to get the description of the test. | | getWeight() | Allows you to get the weight of the test. | | getScore() | Allows you to get the score of the test. | | getSnippets() | Allows you to get the list of snippets. |

License

MIT-licensed