0.0.8 ā€¢ Published 2 years ago

@istanbul/core v0.0.8

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

What Is It?

It contains some core packages for the istanbul framework to work in certain standards. Although it was developed for the istanbul framework, you can use it if you want.

You don't have to use istanbul framework, @istanbul/core is a nodejs package.

šŸ”— access on npm

Installation

npm install @istanbul/core

or with yarn

yarn add @istanbul/core

Usage Results

import { SuccessDataResult } from "@istanbul/core";

export type Product = {
    id: number;
    name: string;
    price: number;
}

const product : Product = {
    id: 1,
    name: "Product 1",
    price: 10
}

const result = new SuccessDataResult<Product>("Product created successfully", product);
console.log(result);
/**
 success: true,
 message: "Product created successfully",
 data: { id: 1, name: "Product 1", price: 10 }
 * */

Usage Errors

import {BadRequestError} from "@istanbul/core";

const error = new BadRequestError("Product name is required");
console.log(error);
/**
 success: false,
 message: "Product name is required",
 code: 400
 * */

When the framework is completed, the document will be made more detailed.